When sweat evaporates from the surface of your skin, it removes excess heat and cools you. Essential if you're in a desert. Unfortunately, when we are nervous or afraid, this also produces an increase an epinephrine secretion in our sweat glands, the palms and armpits to make sweat. Hence that 'cold' sweat we feel when asking out a hot date.
There are two types of sweat gland: eccrine and apocrine. When the eccrine sweat gland is stimulated, our cells secrete a fluid similar to plasma. It is mostly water with high concentrations of sodium and chloride and a low concentration of potassium. The apocrine sweat glands produce the same, however, they also include proteins and fatty acids, which make it thicker and give it an opaque colour. It's this type of sweat that bacteria love. Unchecked, they metabolise the proteins and fatty acids and produce an unpleasant odour. But that's where our Deodorant slides in to fight the bacteria.