Published in hometips.com, 'Water Heater Troubleshooting & Repairs'
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. To solve these kinds of issues, consider installing a whole house water filter and/or a water softener.
If the problem is only with the hot water, 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. Let the hot water run for two or three minutes. If it smells a bit like rotten eggs, you can try flushing the hot water heater tank (see How to Flush a Water Heater). If this doesn’t solve the problem, the anode rod may need replacement by a water heater repair person.
If you smell a garlic-like scent, the pilot light may have gone out. Turn the gas valve control to OFF (you may have to push down to turn it). Wait until the gas smell has dissipated before relighting the pilot light. If the gas smell is strong and doesn’t dissipate, immediately turn off the gas supply valve, ventilate the space, and call a plumber or your gas utility company from a remote location.