Why your water heater is making noise can be caused by a number of different reasons and the sounds made will be different for each of those reasons.
A rattling sound or humming sound while hot water is running can be caused by heat trap nipples which are located on the inlet and outlet of the water heater. These heat traps help to reduce the loss of heat from in the tank by convection or, thermosyphoning up the pipes attached to the water heater. The heat traps use either a ball checkvalve or, a checkvalve with a rubber flapper which sometimes make noise with the water rushing past them. Replacement may eliminate or, change the noise.
An electric water heater may make a high pitched whistling sound or, a hissing sound when heating. This can be caused by an element that is covered by minerals from hard water or, an element that has a pinhole leak in the element allowing water to contact the heating coil inside the element. Replacement with a low watt density element will eliminate the noise.
A water heater that is making popping noises when heating is caused by an older water heater that has a large accumulation of minerals on the bottom of the tank from hard water. These minerals can be removed by routinely flushing the water tank as part of the periodic maintenance you should perform on your water heater. These mineral deposits are either covering the bottom in a thick layer on a gas water heater or, have completely covered the bottom element on an electric water heater and are not allowing direct contact of the heating surface to the water. Water within the mineral layer is super heated to steam then explodes out of the mineral layer into the water in the tank making a popping sound. If you hear this noise it is probably too late for flushing to do any good and the water heater is no longer heating efficiently. Replacement is probably the best option.