Many causes. Deterioration of the normal chemical constituents. Microbial growth. Contamination with any number of things.
The vast majority of known chemicals have no odor at all. The chemical compounds that emit an odor are generally small organic molecules with up to 15 or so carbons, and a limited number of polar functional groups.
Above that range, the odors (if any) are faint and the molecules are too heavy to evaporate quickly. Pheromones, perfume bottom notes, and musks are examples. Oily liquids become viscous and then waxy solids with longer carbon chains.
Microbiological growth – The worst off-odors from microbial growth come from breakdown of the product’s protein and fat/oil, not the carbohydrates or minerals.
Petroleum hydrocarbons – usually refined into distinct fractions or ‘cuts’ in narrow boiling point ranges. The smallest hydrocarbons are practically odorless (methane, ethane, propane and butane) and they are gases at room temperature. Pentane (5 carbons) is the most ethereal of the liquid hydrocarbons; it’s boiling point is ~ 97 F / 36 C (around body temperature). Charcoal lighter fluid starts in this range. Above 10 carbons (kerosene & diesel fuel), their petroleum odors become heavier and eventually fainter. like pump oil or liquid petrolatum, and they take much longer to evaporate. Around 18 carbons and above, the solidified paraffin waxes have very little odor. The “aromatics” (containing the benzene ring) are more offensive smelling and more toxic than the aliphatics (linear hydrocarbon chains).
Pesticides: Most pesticide molecules are too large or have too many polar functional groups to possess any odor. Some exceptions are the sulfur-containing (phosphorothio-) compounds, and some of the smallest volatile organochlorines (e.g. fumigants). Many familiar insecticides are diluted down to a usable concentration in a petroleum solvent or petroleum distillate. They are fully effective in very dilute concentrations, often just 1% active ingredient. In bug sprays for home and garden use, what we are smelling is the >90% petroleum “carrier” inert non-active ingredient. In recent decades, most of the pyrethrin canned bug spays have a petroleum alkane distillate in the C11 to C14 boiling point range and have no aromatics or PAHs and not many alkenes (as measured by GC and GC-MS).
Sulfur odors and sources: In uncontaminated food, usually comes from metabolites of the two sulfur-containing amino acids, methionine and cysteine, The dialkyl polysulfides and their precursors in onion & garlic come from cysteine. In microbiologically spoiled foods, the sulfurous odor is partly methylthiopropanol, from methionine via the Strecker degradation pathway. Dimethyl sulfide can arise from S-methylmethionine by thermal decomposition during pasteurization or concentration.
Sulfur dioxide preservative added to packaged dried fruits can be unpleasant when at high levels in freshly opened packets. Mixed thiophenes from crude petroleum add an ominous sulfur note to the less offensive hydrocarbon smell. A few of the phosphorothio- (organophosphorus) pesticides have a sulfur odor, often from trace level impurities. Less commonly encountered are other elements also in the Periodic Table’s Group 16 column right below sulfur (selenium and tellurium). H2S (swamp & sewer gas, rotten eggs smell, the simplest smallest sulfur compound, chemically analogous to H2O). In natural gas for stoves etc, small sulfur-containing mercaptans or thiols are added so that dangerous leaks are immediately detectable by the human nose.
Lipids – fats/oils. Off-odors derive mainly from fatty acid breakdown and oxidation. PUFAs are most susceptible because of all the double bonds.
Nitrogenous compounds – proteins, amino acids, amines, heterocycles. Occasionally phospholipids break down and release trimethylamine (fishy smell). Putrefactive (a.k.a. biogenic) amines from bacterial spoilage: putrescine, cadaverine, indole
Terpene breakdown products (mainly monoterpenes), turpentine as a non-polar solvent and cleaner, Pine-Sol, isoprenes. They are very well characterized in countless orange juice shelf life studies going back 60 years and more (d-limonene to a-terpineol and p-cymene with several intermediates). Pine forest studies (atmospheric breakdown). Some are unstable during low temperature distillation for flavor extractions and purifications, so milder liquid/liquid extraction is performed. With the flavor oils used to make drinks, the monoterpene hydrocarbons (C10H16) are selectively removed in many cases, since they’re the quickest to break down and they don’t contribute much to the overall aroma. Besides the C10H16 hydrocarbons, there can be an alcohol, aldehyde, ketone or other functional group (usually only one).
Musty odor – 3 main chemical families