Cooking is about turning raw materials into other materials using heat. Cooking is really a kind of chemistry, although we take that for granted.
We cannot digest many foods properly when they are raw. Cooking applies heat to these foods so they change their composition and become easily edible. A simple example is meat. We could eat meat raw, but cooking it changes the fat in the muscle parts of the meat, making them easier to chew and digest.
Cooking produces many new foods, such as bread. Bread is made with a dry mixture of something like flour, sugar, baking powder, yeast and salt. Together as a dry mixture nothing happens. When water is added, the mixture becomes a dough. The yeast now consumes the sugar and gives off carbon dioxide gas, making bubbles and causing the dough to rise.
It is possible to eat raw dough, but it is not very nice. However, by baking it, the ingredients combine to produce a much drier substance that is easy to eat.
Cooking is also useful because it kills off microbes, and so makes it less likely that we will get infections.