When I was younger I used to ask the very same question, but as life goes by I realize that the cause of many obesity situations is an unhealthy lifestyle that grows like a snowball until it reaches a point of no return for some.
Let's break it down.
Being social creatures, we tend to do what is "normal" in our social groups, the summer BBQs, Beer and alcohol during games and social events, Thanksgiving meals, Birthday cakes, etc. The thing is when you are younger, more active with a higher metabolism, you can get away with this lifestyle. But seemingly overnight things can change in a big way, very fast, and for many, it comes during the worst time possible, that is when you have kids, working hard, and those things that you liked now become your way to chill and mentally get your shit ready for the next shift.
This way of life becomes a vicious cycle of getting stressed out in life and then rewarding yourself by doing shit that makes you feel good, not only this, it becomes a social bond between you and your loved ones, with part of your mind convincing yourself that its normal, everyone does it, and you are not that fat, so your good.
But then, seemingly overnight you and everyone you are with balloons up while the pressure of life becomes even greater (child support, job stress, woman stress, and the bills that never stop rolling in). This is the critical stage where you can say fuck it and live to feel as good as you can or do something to change your lifestyle to fight it, and if you lack proper discipline like most Americans, trying to fight it becomes a Herculean task, but if you don't you can easily spiral into obesity, and the health complications that come with it.
The keys to avoiding it, are discipline, being an independent thinker (because there are going to be times when you are the oddball and the only one not eating, drinking, or doing activity that goes against your new lifestyle decisions), from there you take one day at a time, slow but steady, no excuses or victim mentality. One thing I did was replace unhealthy choices such as alcohol, fast foods, and even coffee, and replace them with better options, such as weed, natural home-cooked food, and for a coffee replacement I microdose kratom. The more you research and think outside the box the more you realize that our lifestyle and what we consider normal is usually not the healthiest and it will lead you down to poor health, obesity, and eventually death, and your ability to properly research and discern bullshit information out there can be a big plus towards recovering your health, while still having the fun you need to combat against life stresses!