On a totally logical level you are right. It is strange that people let themselves get fat. But human beings are not logical.
We all do things that aren't strictly in our best interests. For example, drink too much, don't take enough exercise, eat things that aren't good for us, smoke cigarettes, don't go to our GP when we should, stay out in the sun too long, don't get enough sleep, eat too little, etc etc.
We are all just trying to get through life which at times can be great fun, but at other times is just a hard difficult slog. People do some things that are bad for them because they are trying to hang on there when things are tough e.g. it is very common to eat too little or too much or drink too much when life is very very tough.
Other habits such as eating lots of chocolate or smoking are very very difficult to break. Which is why there is an enormous diet and stop smoking industry.
There will be things you do that are not in your best interests that others won't understand. For example I find it very hard to understand why people become drug addicts. I have taken illegal drugs a few times and found it very very easy to resist the temptation to take more. Similraly why people risk their health using sun beds.
Because human beings are complicated, it is rare to find someone who doesn't do things that are not in their best interests.