You actually have two questions there because deodorants and antiperspirants are two different things. By itself, sweat doesnt have a lot of odor. But the bacteria that live in our armpits and eat skin cells, oil, and such produce smelly byproducts.
Antiperspirants plug up our sweat glands so that we sweat less. A drier environment also discourages bacteria. People who are afraid that others will see them sweat through their clothes in stressful situations may use antiperspirants.
Deodorants dont keep us from sweating, but they keep bacteria populations down by poisoning them with acids, salts, or other things. These substances are usually too mild to bother us humans, but some people are sensitive to them. Our skin is covered with bacteria, so once the deodorant wears off, new bacteria move in. By the way, lots of the bacteria in and on our bodies help us, so try not to be grossed out by thinking about them.
Many products also have strong odors of their own that can cover up some of the sweat odor, but some people find these odors worse than the body odor. Some products contain deodorants and antiperspirants, plus camouflaging perfumes.
Sweat actually serves useful functions. It cools us off when we get too hot. It allows us to get rid of some wastes, and it may even be a way to communicate.
Lots of people are interested in the study of sweat. Lie detectors or polygraph tests record sweating (among other things). I found some stories that propose using sweat to detect drug use or tell who is really stressed out to identify dangerous people. Some studies have shown that mosquitoes can use the odor of sweat to find their next victims.
If you wanted to test which product was best at stopping body odor, how could you do it? It might be a good science fair project. Thanks for asking,