Sulfur or "rotten-egg" odors can develop in water heaters and in corroded iron piping even if the water is chlorinated city water. This usually occurs if the water has a low chlorine residual, high levels of sulfates, and/or the water has sat inactive for days or weeks.
The incidence of rotten egg odor or black water in water lines is due to the reaction of sulfates and microorganisms in water. To determine the source of the odor, it is important to check to see whether the cold water contains odor, or just the hot water.
If the odor is coming from the hot water only, then the odor can be eliminated by shock chlorination of the water heater, changing the magnesium anode rod to a zinc or aluminum anode rod, or if on well water, by the installation of a chlorine feeder.