If you don't get the odor when you heat a pot of water on the stove, then the problem has to be chemical buildup in your hot water heater. Possibly something in the water supply is being precipitated out by coming in contact with the hot element....
I see this problem about once a month. It has to be something that they treat the water with because I have seen it on 2 separate water sources from 2 different water towers. Depending on what it smells like (kind of sulphur smell around here) the only way I have been able to make it go away is to flush the heater until the smell goes away. It usually happens to places where there isn't anyone living for a month or more. Sometimes even when someone is there and using water. But I believe it has to be a chemical from the water or something in the heater reacting with the water.