What causes the rancid smell during rotting or decomposition?
At least some of that smell comes from the bacteria that are decaying a dead organism. When bacteria feed on a dead organism, they produce gas as a waste product just like we produce gas when we eat certain things. Some of that gas is hydrogen sulfide, better known as “rotten egg smell.” Not much you can do about it unless you get rid of the dead organism (and therefore the bacteria), mask the smell with another smell (like room freshener), or increase air flow to blow out the gas (open a window).