Certain water conditions cause a reaction between the anode rod and supply water, which results in hydrogen sulfide gas being dissolved in the tank water. The hydrogen sulfide gas emerges in the hot tap water causing a rotten-egg smell. Installing a less-reactive aluminum alloy anode rod and chlorinating the water supply system eliminates the rotten-egg smell in hot water.
These repairs may help solve your water heater problem
Replace the water heater anode rod
The anode rod protects the tank from corrosion. A chemical reaction between the supply water and the anode rod can produce hydrogen sulfide gas and cause the hot water to smell like rotten eggs in some conditions. Replace the anode rod with a less-reactive zinc-aluminum anode rod to combat the rotten-egg smell.