What that rotten egg smell actually is
You're smelling hydrogen sulfide gas dissolved in your hot water. It's produced inside the tank when sulfate-reducing bacteria meet the sacrificial anode rod.
The anode is a metal rod (usually magnesium) that corrodes on purpose so your steel tank doesn't. When bacteria are present, that corrosion reaction throws off hydrogen sulfide, which is the source of the smell.
The good news: this is one of the more fixable water heater complaints. Most homeowners solve it themselves for $20–$100 in parts.
The key diagnostic question is simple. Does only the hot water smell, or does the cold smell too?
Why it's happening in your tank
In nearly every hot-only case, the culprit chain is the same: sulfate-reducing bacteria plus a magnesium anode rod plus warm, still water.
The bacteria are usually already in the water supply at low levels. The tank gives them a warm, oxygen-poor home to multiply. The magnesium anode gives them the chemistry they need to make hydrogen sulfide.
That's why the standard fix attacks all three: change the anode metal, disinfect to kill the bacteria, and raise the temperature to keep them down.
A few things make it worse. Well water tends to carry more of these bacteria than treated city water. A water softener can push the chemistry toward smell production.
And low usage is a big one. A tank that sits (guest bathroom, vacation property, a house on the market) grows bacteria far faster than one flushed with fresh water daily.