The most basic function of bodily fat is self-storage of food reserves.
In prehistoric times, natural selection favored genotypes that could endure harsh conditions by stocking the most fat.
With chronic malnutrition being the norm for most of human history, genetics evolved to favor fat storage.
So when did body fat become problematic?
The negative impacts of being overweight were not even noted in medical literature until as late as the 18th century.
Then, technological advances coupled with public health measures resulted in the betterment of the quantity, quality, and variety of food.
Sustained abundance of good food enabled a healthier population to boom economically.
Output increased, and with it, leisure time and waistlines.