Many of the food items humans enjoy are appetizing to molds and other fungi, too. Preservatives like vinegar, potassium sorbate and sodium benzoate inhibit the growth of molds and other undesirables, so food stays edible for a longer period of time. These chemicals work their magic in a variety of ways.
Vinegar is one of humankind's oldest preservatives; people have pickled food to prevent it from spoiling since ancient times. Pickling both delays spoiling and enhances flavor as well. The highly acidic lactic acid and vinegar solution make the inside of a pickle jar a hostile environment for most microorganisms, which is why pickles don't grow mold quite so rapidly as cucumbers left too long at the back of your fridge.
Many of the enzymes that play crucial roles in fungi and other microorganisms need metal ions like magnesium to function. These metal ions act as cofactors or enzyme-helpers. Metal chelators like EDTA bind tightly to metal ions; they deny them to fungi and other troublemakers. By reducing concentrations of important cofactors in various food products, EDTA can work together with other preservatives to help delay mold growth.
Other preservatives are poisonous to microorganisms and react with important molecules in the microbe to damage it or even kill it altogether. Benzoates, for example, are weakly antimicrobial compounds that work best at acidic pH; in a more acidic solution, most of the benzoate molecules are found as benzoic acid, which is better able to cross bacterial and fungal membranes. Potassium sorbate is similar in that it also works best at acidic pH. According to the book "Mechanism and Theory in Food Chemistry," scientists aren't yet entirely sure how these preservatives work, although it's believed they disrupt the membrane transport system of the fungus.
Sulfur dioxide, sulfite salts and bisulfite salts are collectively called sulfites in the food industry because sulfite and bisulfite ions can convert to sulfur dioxide and vice versa in solution. Sulfur dioxide is able to cross microbial cell membranes; once inside, it wreaks havoc with a remarkable variety of pathways in the microbe, reacting with nucleosides, amino acids, coenzymes and pyrimidine bases. These destructive reactions may be fatal for the fungus. Unlike fungi, humans and other mammals have an enzyme that can convert sulfite to sulfate and thereby render it harmless.