Obesity is a multi-factorial illness, what this means is that there are several causes of obesity.
Let's first talk about genetics, there is a genetic component to being obese. Unfortunately there's nothing we can do about that though. The good news is that there are other causes of obesity which we can control. One of them might be other health conditions.
For example, if you have an under active thyroid that's not properly treated you can gain weight and eventually become obese. Other medications may also lead to obesity. These can be medications such as insulin, steroids, and even some antidepressants. Most of the time however, obesity is not caused by a medical illness that you have.
Obesity occurs when you have excess fat storage. When you eat food it's digested and then the nutrients are absorbed into your bloodstream. You burn calories throughout the day, the excess calories that you don't burn eventually become stored as fat. So if you're eating more than you're burning off you're going to become obese.
A sedentary lifestyle can also lead to obesity. If you have a job where you're sitting at a desk for most of the day and you don't really get up and walk around, that can also cause obesity because you're not burning those calories that you're eating throughout the day.
So you want to make sure that you eat and you make good choices with your foods and also that you try to maintain some level of activity in your life.
So those are some of the causes that can contribute to obesity.