Scientists know that sweating is a cooling mechanism that keeps us from overheating, but they don’t know why we sweat instead of cooling down in other ways.
Other animals have sweat glands, but most of them go almost entirely unused because the animals have developed different methods to cool their blood and regulate their body temperature.
Rabbits, for instance, rush blood through their ears to cool their body. Dogs pant. Some animals wallow in mud or water, and still others urinate on their legs.
Humans release two substances from over two million sweat glands in the skin, which tends to attract bacteria that smell bad.
The explanation that seems most likely comes from the famous anthropologist Louis Leakey. His theory is that humans once used body odor as marking for their territory and to ward off predators.
Eventually humans learned to defend themselves with weapons, but the strong smell lingered on.
Now human smell tends to ward off other humans, as well as anything else with a nose.
As a result, societies have engaged in the war against body odor. Early weapons include perfumes, herbal concoctions, and sometimes even bathing.
Late in the 19th century, scientists developed antibacterial solutions that killed germs growing in the armpits or on the feet, and in the 20th century, along came sweat-blocking agents called antiperspirants.
So far, these substances are the most successful solutions to B.O. in the course of human history.
Until we come up with something else or evolve out of our sweat glands, they’ll just have to do.