Your water heater (and probably the rest of the water system) has a microbe that emits sulfur dioxide. It's not harmful to humans, but it stinks when the water is heated. You need to sanitize at least the heater tank, but preferable the entire system. Otherwise, the smelly microbes will probably soon return.
The vinegar solution described above may work, but a chlorine or peroxide sanitizing is more reliable.
This video from Suburban describes the problem and solution.