When I was in the peak shape of my life (178 and stacked), it was following being in the worst condition in my life (315), after more than 7 years of constant careful attention to my calorie intake, every other day exercise, and meticulously recording it all so I could keep myself honest. It didn't evaporate overnight either, I was able to maintain a good state of health without being so controlled while I was traveling, but once the pandemic happened and I became sedentary my loss of control over my eating caught up to me over the next 14 months and I gained nearly 40 pounds back prior to getting myself back under control. Now I'm on that journey again back to a healthier weight.
The things we do every day, the small choices we consistently make, these form the habits of our lives. I have good habits and I have bad habits, and it's a consistent struggle for me (and likely everyone) to overcome our bad habits and turn them into good habits. Some of these habits, including my relationship with food, came from my environment as a child, so the work of a lifetime forming them is often difficult to overcome, but it's never impossible.