If only the hot water smells, it may be due to the anode rod in the water heater. Soft water can erode magesium rods, producing a gas that causes the odor. An aluminum or powered rod can solve this. If the odor is present in both hot and cold water, it may indicate other issues.
