Why did a medieval cook cook?

Because cooked foods are easier to digest, and can be kept longer than raw foods.