Garbage disposals grind food wastes into small particles, and the ground wastes are washed away into the main sewer system. But like any grinder, some of these food wastes can stick to your disposal.
Your garbage disposal smells because of the rotten food wastes sticking inside it. This rotten smell can be avoided only by cleaning the garbage disposal regularly and running plenty of water each time the disposal is running to wash away all food debris.
Alternatively, the smell can also be due to the sewer gases coming out of the disposal as a result of inefficient venting.
Where does the rotting smell in your garbage disposal come from
A garbage disposal uses a fast-rotating impeller and a stationary shredder ring to break down food waste. There are tiny crevices under the impeller and other grinding components where food wastes can stick, refusing to be washed away by the running water. Being wet and ground, these food wastes will rot within a few days and start to smell. They are the primary source of the smell, and it is impossible to get rid of these smelly, paste-like particles without using some abrasive cleaning agents such as ice cubes.

Here is a good guide to cleaning a smelly garbage disposal.
You will also find lots of food residue under the splash guard of your garbage disposal. When the food wastes are ground, they splash around in the garbage disposal chamber, and some of them stick to the underside of the splash guard. Even though you run water, the splash guards’ underside does not get wet, so the food waste will stay there rotting and smelling.
Depending on the type of food wastes you add and the extend of the rot, your garbage disposal can smell like fish, dead animals, mold, rotten eggs, etc., the list is not exhaustive, but I can guarantee that these will never be nice. In addition, this can lead to an infestation of flies and gnats inside the disposal.
There can also be food residues where the garbage disposal meets the kitchen sink. This can happen if the sink mount is not tightened properly. This location is hard to reach without disconnecting the disposal. So the only practical solution is to make sure that the mount is tight and not leaking.
Leaks in your garbage disposal too can contribute to the rotting odor. Food particles will come out with the leaking water, and they will rot and smell. A disposal can leak from its side, top, and bottom. You can often fix the leak from the top using a sealant. The same can be done for the leaks from the side, often found where the elbow pipe meets the disposal outlet. One cannot fix a disposal leaking from the bottom, so the smell is not your primary concern in this case.
In some cases, the smell may not be coming from the garbage disposal. There can be leaks or blocks further down the pipeline or damaged air vents, which will direct the sewer gases into your kitchen. In such a case, it is better to seek a professional’s assistance rather than trying to mend it yourself.
The only way to get the rotten smell out of your garbage disposal is to clean it regularly and run plenty of water while using it. Adding some dishwashing liquid into the disposal while grinding also helps to mitigate odors.