Free fatty acids. That is, fatty acid molecules that have been broken off from their fat molecules. Most fatty acids are foul-smelling and bad-tasting chemicals, and it doesn’t take much of them to give a fatty food an off flavor.
There are two main ways in which the fatty acids can become disconnected: the fat’s reaction with water (hydrolysis) and its reaction with oxygen (oxidation).
You might think that fats and oils won’t react with water because they are so loathe to mix. But given time, enzymes that are naturally present in many fatty foods can make the reaction happen. (Tech-speak: They catalyze the hydrolysis.)
So foods like butter and nuts can turn rancid by hydrolysis simply by being stored for a long time. Butter is particularly vulnerable because it contains short-chain fatty acids, and these smaller molecules can fly off into the air more easily (Techspeak: They are more volatile) and produce a bad smell.
In rancid butter, butyric acid is the main culprit.
High temperatures also speed up the rancidity of an oil by hydrolysis, such as when wet foods are deep-fried in it. That’s one reason why deep-frying oil begins to smell bad when overused.
The second major cause of rancidity, oxidation, happens most readily in fats containing unsaturated fatty acids, with polyunsaturates being oxidized more readily than monounsaturates.
The oxidation is speeded up (catalyzed) by heat, light, and trace amounts of metals, which may be present from the machinery that processed the food. Preservatives such as ethylenediaminetetraacetic acid, mercifully nicknamed EDTA, prevent metal-catalyzed oxidation by imprisoning (sequestering) the metal atoms.
Moral: Because rancidity reactions are catalyzed by heat and light, cooking oils and other fatty foods should be kept in a cool, dark place. Now you know why the labels always tell you that.