Cooking is often framed as something that degrades food. It changes food in several directions at once, and the direction depends on the nutrient and the method.
Plant cell walls limit access
Nutrients in plants are held inside cells surrounded by walls made largely of cellulose, which human digestive enzymes cannot break down.
Anything the cell wall retains is unavailable, because digestive enzymes cannot reach the contents.
Heat weakens and ruptures those walls, releasing the contents into a form the gut can absorb. This is the main reason cooking increases the availability of several nutrients.
Some compounds become more available with heat
Carotenoids, including the pigments in tomatoes and carrots, are absorbed considerably better from cooked than from raw material.
They are fat-soluble, so absorption also depends on fat being present in the same meal, and heat plus fat together change the outcome more than either alone.
Starch behaves similarly. Raw starch granules resist digestion until heat and water cause them to swell and gelatinise, which is why raw potato is largely indigestible.
Others are lost to heat and water
Vitamin C is both heat-sensitive and water-soluble, so it degrades with prolonged cooking and leaches into cooking water that is often discarded.
Several B vitamins share the water-soluble property and are lost the same way, with boiling causing the greatest loss and steaming considerably less.
Cut surface area matters too, since finely chopped material loses more to the water than large pieces do.
Heat also removes things worth removing
Many plants contain compounds that interfere with digestion or nutrient absorption, and several are reduced by cooking.
Certain raw legumes contain proteins that are harmful if eaten in quantity and are destroyed by adequate heat, which is why soaking and thorough boiling are standard preparation.
Cooking also kills bacteria and parasites, which is a separate and substantial benefit that nutrient comparisons tend to leave out.
Method matters more than the raw-versus-cooked question
Because different nutrients respond differently, no single answer covers a whole food, let alone a whole diet.
Shorter cooking times, less water, and using the cooking liquid where practical reduce losses without giving up the gains in availability.
Variety across preparation methods is the practical consequence, since it avoids optimising for one nutrient at the expense of another.
It is also worth noting that the nutrient content of a food matters only in proportion to how much of it gets eaten, and preparation strongly influences that.