The quick answer to that is antiperspirant stops you from sweating, while deodorant stops you from smelling.
Deodorant kills the bacteria on your skin, so when you sweat there aren't enough bacteria sitting on your skin to multiply and create an odour.
If you’re worried about sweat stains on your clothing an antiperspirant is the better product for you. These contain aluminium salts that dissolve in moisture on the surface of your skin. As it dissolves, it forms a gel that temporarily blocks your sweat glands and helps prevent additional sweating.