Eating fatty foods is one of the causes of gaining weight. There are many things that are responsible for gaining weight.

Genetics
If you have a family history of obesity, you might gain weight suddenly. So, gaining weight is also related to your family history.
Medicines
Medicines have side effects. When you take medicines, you can gain weight as a side effect of taking medicines.
Depression and stress
If you are under depression and stress, that could be the cause of gaining weight. Stress can be from your professional life or personal life. It leads to emotional eating.
Large portion of food
You are eating healthy, but still gaining weight. If you eat a lot, it could be the reason of gaining weight.
Pregnancy
When women are pregnant, they have to eat more. They usually gain weight at that time.
Less sleep
Scientists found that if you sleep less, this can cause weight gain. So, sleep deprivation is one of the reasons.
Inactive lifestyle
If you do not move much, sit and watch TV or play video games for example, you can gain weight. You have to change your lifestyle to lose weight.
Still, there are many causes of gaining weight. I just mentioned some of the causes above.


