Some body fat is absolutely helpful in protecting from drowning [1]. You see a similar curve when mapping life expectancy and mortality risk against BMI—the optimum is a bit thicker than our guidance suggests. (Saying this as someone who has to fight to keep weight on.)
> the optimum is a bit thicker than our guidance suggests
That's probably confounded. Anything over a BMI of 23 better be an increasing proportion of muscle, and even then there's a point that the stress on the heart isn't worth it.
Almost every physical and mental heath condition does bad things to nutrition and internal energy stores, even if only at a diet level.
It's hard to see since so many people are overweight or obese to start with, but the overall correlation goes that way enough to cause confounding.
[1] https://pubmed.ncbi.nlm.nih.gov/28915131/