
Most people have a hand in food preparation at some time in the day. Even those who subsist on “instant meals” will at least zap it in the microwave for the necessary amount of time. Some people however cook intricate dishes, for their own amusement or for friends and families.
Most people eat cooked food although there is somewhat of a fad for raw food at the present time. All sorts of diets are also touted as having some sort of benefit for the food conscious, all of which seem bizarre when one considers that many, many people around the world are starving.
Cooking can be described as applied chemistry, as the aim of cooking is to change the food being cooked by treating it with heat in one way or another. All the methods treatment are given names, like “boiling”, or “baking” or “roasting”. In the distant past no doubt such treatments were hit and miss, but these days, with temperature controlled ovens and ingredients which are pretty much consistent, a reasonable result can be achieved by most people.

I’d guess that the first method of cooking was to hold a piece of meat over a fire until the outside was charred and much of the inside was cooked. However, human ingenuity soon led to spit roasting and other cooking methods. A humorous account of the accidental discovery of roasting a pig was penned by Charles Lamb. In the account the discovery came as a result of an accidental setting fire to a pig sty, and consequently, as the idea of roast pork spread this led to a rash of pig sty fires, until some sage discovered that houses and sties did not need to be burnt down and it was sufficient to hang the pig over a fire.
I’d suspect that while roasting may have been invented quite early by humans, cooking in water would have come along a lot later as more technology is needed to boil anything. That is, a container would be needed and while coconut shells and mollusc shells can contain a little water, and folded leaves would do at a pinch, when humans invented pottery, the art and science of cooking was advanced immensely.
Although the foods that we eat can pretty much all be eaten raw, most people would find cooked food much more attractive. Cooked food smells nice. The texture of cooked food is different from the texture of raw food. I expect cookery experts are taught the chemical reactions that happen in cooking, but I suspect that cooking breaks down the carbohydrates, the fats, and the proteins in the food to simpler components and that we find it easier to digest these simpler chemicals.
Maybe. That doesn’t explain why cooked food smells so much nicer than raw food. If food is left to break down by itself it smells awful, rotten, and with a few exceptions we don’t eat food that has started to decay.
Maybe the organisms that rot food produce different simpler components, or maybe the organisms produce by products that humans dislike. Other carnivores don’t seem to mind eating carrion and maybe a rotting carcass smells good to them.

The rules of cooking, the recipes have no doubt been developed by trial an error. It is likely that the knowledge was passed from cook to cook as an aural tradition initially. After all, cooking is likely to have started a long time before reading and writing were invented. Since accurate measurements were unlikely to be obtainable, much of the lore or cooking would have vague and a new cook would have to learn by cooking.
However, once the printing press was invented, after all the bibles and clerical documents had been printed, I would not be surprised to learn that the next book to be printed would have been a cook book. I’ve no evidence for this at all though!

Cooking changes the texture of meat and vegetables, making them softer and easier to eat. Connective tissues in particular are released making a steak for example a lot more edible. Something similar happens to root vegetables, swedes, turnips, carrots and parsnips. These vegetables can be mashed or creamed once they are cooked, something that cannot be done to the rather solid uncooked vegetables.
Cooking is optional for some foods – berries and fruits for example. Apples can be enjoyed while raw when they have a pleasant crunch, or cooked in a pie, when they are sweet and smooth. Babies in particular love the sweet smoothness of cooked apple and for many of them puréed fruits or vegetables are their first “solid” foods.
Chicken eggs are cooked and eaten in many different ways. The white of an egg is made partly of albumen and when this is cooked it changes from translucent, almost transparent, to an opaque white. Almost everyone will have seen this happen, when an egg is cracked into a frying pan and cooked until the clear “white” of the egg turns to opaque white of the cooked egg.
Many other items when cooked change colour to some extent, but the white of the egg is most apparent. When you pair that with bread which is slightly carbonised on the outside, covered in the coagulated fat from cow’s milk (butter) and you have a common breakfast dish – fried eggs on toast.

There’s a whole other type of cooking – baking – that relies at least partly on a chemical reaction between an alkali (baking soda or sodium bicarbonate) and an acid (often “cream of tartar” which is weakly acidic). When the two are mixed in the presence of water, carbon dioxide gas is given off, leading to gas bubbles in the dough. When the dough is cooked the bubbles are trapped inside the stiffening dough, give the baked cake the typical spongy texture.
Some cooking utilises biological reactions. When yeast, a fungus, is placed into a liquid containing sugar, it metabolises the sugar, releasing carbon dioxide, and creates alcohol. In bread making this alcohol is baked off, but it may add to the attractiveness of the smell of newly baked bread. In brewing the alcohol is the main point of the exercise, so it is retained. It may even be enhanced by distillation.
http://www.gettyimages.com/detail/523818827
I’ve just touched on a few highlights as regards the mechanisms of cooking (and brewing!), but I’ve come to realise as I have been writing this that there are many, many other points of interest in this subject. The subject itself has a name and that name is “Molecular Gastronomy”. A grand name for a grand subject.