It happens when your sweat mixes up with the bacteria on your skin, which causes an onion-like smell due to a chemical reaction between toxins in your sweat and bacteria releasing a sulfur smell due to the generation of thioalcohol.