Understanding the chemistry of how foods go bad allows us to design countermeasures to prevent spoilage.
Some of those countermeasures involve knowing what kills bacteria and molds, and what causes food to break down all by itself.
Living things need enzymes to do their job. Enzymes are proteins that use their particular shape to guide chemical reactions. If something changes that shape from its natural form, we call it denaturing the protein. A denatured enzyme usually does not work properly.
One way to denature enzymes is to heat them. When we seal food in cans, we then heat them, to denature all of the enzymes inside. That kills the bacteria and molds, since they need their enzymes to survive. And it also denatures the enzymes in the food, which would otherwise cause the food to break down into an unappetizing mush. It is enzymes that cause fruit to bruise, and meat to spoil.
We can also prevent bacteria and mold from growing by using chemicals. There are two classes of chemicals that prevent bacteria and molds from producing the energy they need to live and grow. These are the benzoates, and the propionates.
Benzoic acid
In acidic foods, benzoic acid, or sodium benzoate can be used to keep bacteria and molds from spoiling the food. Benzoic acid is found naturally in dried fruit, and it may be a natural antibiotic in those fruits. It prevents the microbes from fermenting sugar into alcohol.
Benzoates only work in acidic foods. Calcium propionate is used in foods that are not acidic, such as baked goods. Higher forms of life can metabolize propionates, but in bacteria and mold the molecule interferes with energy production.
Calcium propionate
There are many other molecules that harm bacteria and molds but not people and animals, and are thus used to preserve food. In addition to those, we have molecules like salt and alcohol which can be used in large quantities to kill germs, but then rinsed off before we consume the food.