The evaporation of sweating from the skin’s surface cools the body to maintain a normal body temperature. Nerves of the sympathetic nervous system control the output of sweat glands to regulate how much sweat they produce. Eccrine glands, found all over the body including the armpits, secrete a watery, cooling sweat. Starting at puberty, apocrine glands distributed mainly in the armpit and groin secrete an oily sweat that smells bad when it interacts with skin-dwelling bacteria.
Exercise and Heat
An area of the brain called the hypothalamus contains nerve cells that sense the core temperature of the body and the temperature at the surface of the skin. An increase in the basic metabolic rate, as with exercise or exposure to a hot environment, causes the core and the surface of the body to heat up, triggering the hypothalamus to cool the body by activating the sympathetic nervous system. The sympathetic nerves in turn prompt the sweat glands in the armpits and all over the rest of the body to step up their sweat production.
Stress and Anxiety
Emotional stress and anxiety cause sweating because the hypothalamus, in addition to regulating core body temperature, also works with the adrenal glands to coordinate the body’s fight-or-flight response to stressors. In addition to other actions, this system ramps up basal metabolism to provide extra energy, triggering increased sweating. Emotional stress also prompts release of the hormone epinephrine, also known as adrenaline, which stimulates eccrine and apocrine sweat glands in the underarms. In general, emotion-induced sweating occurs mainly on the palms of the hands, soles of the feet, forehead and underarms. Often emotional sweating is a cold sweat, because it occurs before an increase in core body temperature.
The caffeine in coffee, tea, some sodas and chocolate powerfully activates the sympathetic nervous system to cause sweating. If sweating is a problem, cutting out caffeine might help.
Some medical conditions can cause excessive underarm sweating. The condition known as hyperhidrosis literally means "excessive sweating," much more than is needed to cool the body. In focal hyperhidrosis, excessive sweating primarily occurs in the palms of the hands, soles of the feet, and underarms, while generalized hyperhidrosis causes excessive sweating all over the body. Hormone imbalances -- as in menopause -- can cause hot flashes and sweating. High levels of progesterone, as in pregnancy, can also increase body temperature and trigger underarm sweating. An overly active thyroid gland, termed hyperthyroidism, produces an excess of thyroid hormone. Thyroid hormone increases the body’s metabolism and heat production, ultimately increasing sweating.