If your water has a strange odor, first determine whether the problem is with the source water or the water heater. If the problem is with both the hot and the cold water, or if only the cold water smells, the problem is more likely with your source water. Iron, copper, and other minerals can cause discoloration in water.
If the problem is only with the hot water, the rotten egg odor is caused by a combination of hydrogen, sulfur (H2S), and bacteria. The odor is repulsive, but the gas is not usually harmful at the low concentrations that occur in a household water system. This is not a problem of health but aesthetics. It is unpleasant to take a shower, wash clothes, or cook with water that smells like decay.
In most cases the odor is caused by a reaction between the hot water heater’s anode rod and water that has a high concentration of sulfates. The magnesium anode rod installed in the tank protects the tank surface but generates enough hydrogen to create an odor when it interacts with sulfur in the water or bacteria in the tank. Having a a licensed plumber replace the magnesium anode rod with a zinc-aluminum anode or zinc anode rod may minimize the problem. The most efficient method of eliminating the hydrogen sulfide odor is to control the bacteria. As a rule, chlorination of public water supplies kills the bacteria, but some private well systems may need to be purified by the use of chlorine injectors or ultraviolet light. This will destroy the bacteria. Water softeners can contribute to a smelly water heater as well.