Human body contains millions and millions of sweat glands that secrete a liquid due to exposure to heat, stress, nervousness etc. Basically sweat cools down our body. There are two kinds of sweat glands – Eccrine and Apocrine sweat glands. While Eccrine glands excrete water and salt, the apocrine glands carry secretions of fats and proteins from within the body, along with the sweat, to the exterior surface of your skin. The odorless sweat produced provides nutrients for the bacteria on the skin. The decomposition of sweat by the bacteria only causes unpleasant body odor.
Deodorants contain a chemical called triclosan which makes the skin too acidic or too salty for the bacteria to survive. Hence the body odor is prevented but however it does not prevent our body from sweating.
An antiperspirant works the other way. Its important ingredient is salts of aluminium or zirconium. It acts by clogging the sweat glands by creating a thin coating over them. Thus it prevents the body from sweating. With nothing to feed on, the bacteria does not produce body odor.
It is under debate whether or not the use of antiperspirants has ill effects on the health because it stops the working of sweat glands. Though this has not yet been proved, it is wise not to interfere with the internal affairs of our body cells.