When you expend energy, your body naturally cools down through the release of sweat. When you exercise, you produce eccrine sweat on exposed areas, including your forehead, arms and legs, which prevents your body from overheating. Your body produces apocrine sweat on unexposed areas, including your armpits, groin and feet.
When you finish a heavy exercise session, you may blame the odor on the sweat, but it does not produce the odor. The odor is caused by bacteria that combines with your sweat. In particular, it's the bacteria mixed with apocrine sweat, containing proteins and fats, that produces an odor.
The ammonia smell may be caused by your diet. A diet high in proteins and low in carbohydrates causes the body to find other kinds of fuel to continue burning fat. The body will use amino acids to compensate for the low amount of carbohydrates. As the body burns these proteins, it results in an ammonia smell.
Hydrating when you consume a high protein diet is critical. Drink plenty of water after you workout and through the day to stay hydrated. Additionally, you can add healthy carbohydrates to your diet before a heavy sweat session as a way to keep the ammonia smell at bay.
If you address your diet and still smell ammonia, talk with your physician to determine if the smell is due to a medical problem, including liver and kidney disease.