If you are on a well,
The most common cause of smelly water is anaerobic bacteria that exist in some water and react with sulfur and the magnesium and aluminum sacrificial anodes that come with most water heaters to produce hydrogen sulfide gas, making the classic rotten egg odor.