Sweat itself does not in fact smell. The familiar smell of body odour, or B.O, comes from normal skin bacteria breaking down the sweat secretions released from the sweat glands.
Body odour mainly originates from the apocrine glands in the armpits, which release a thick, oily sweat rich in proteins and lipids which bacteria on the skin feed on.
The warm, damp conditions of the armpit are also a perfect environment for bacteria to thrive in and create smelly odours. Body odour occurs during exercise and when we feel strong emotions, because these are the triggers for the apocrine gland to secrete sweat.
Body odour begins during puberty. This is because the apocrine glands, which are involved in causing body odour, begin to function from puberty. As we age, our apocrine glands slow down in function, which means that elderly people tend to have less body odour.1References
1. Unilever. Facts about Sweating