Humans sweat to regulate body temperature, so it makes sense that keeping cool and comfortable is one way to prevent underarm odor. As your body temperature rises, your nervous system stimulates the eccrine glands to secrete fluid onto your skin, where sweat -- made up mostly of water and salt -- cools the body as it evaporates.
In addition, apocrine glands secrete a fatty sweat, and emotional stress can push the sweat to the surface of the skin. While sweat itself is practically odorless, bacteria on the skin can break down apocrine sweat, resulting in an unpleasant odor.
So how can you use this information to prevent underarm odor? Try to keep room temperatures a few degrees cooler if possible, especially in areas where you're sleeping or working. Wear light, breathable layers that are easy to remove as you feel your body temperature rise. If stress makes you break out into a sweat, make stress management techniques a part of your routine. Habits such as regular exercise, meditation, improving time management and organization, and maintaining a strong emotional support system will help you stay calm, cool, and collected – and fresh!