Prompted by an original question on the quora.com website?
It’s an excellent question, and the simple answer is that it could be either, or both.
Weight gain happens for only one reason; you consume more energy (normally referred to as calories) than you burn.
Energy consumed is simply the function of eating and drinking. The more you eat and drink, the more energy you consume.
Energy burned is simply the function of moving the body. The more you move, the more energy you burn.
Now to the question. What you eat obviously makes a difference to how much energy you consume. There are three “macro” nutrients in the food and drink that you consume; proteins, carbohydrates (carbs) and fats.
In terms of energy, carbs and proteins each contain about 4 calories per gram and fats contain about 10 calories per gram. Most foods contain a mixture of proteins, carbs and fats and the ratio of each determines how much energy the food has in it.
A simple example is almonds (or nuts in general - each kind of nut is slightly different, but in broad terms they are similar). 100 g of raw almonds contains 55 g of fat and 23 g of protein. There are very few carbs. 81% of the energy comes from the fats and 15% from the proteins and in total, that 100 g will give you 622 calories of energy.
Compare this with 100 g of cucumber. Cucumber is almost all water, with only 1.5 g of carbs, 0.7 g of protein and 0.1 g of fat. 60% of the energy comes from the carbs and 30% from the protein, but the whole 100 g will only give you 10 calories of energy.
Those are two extremes, but they show you that the same weight of two different foods can vary very widely in terms of the amount of energy they give you.
That deals with the what, now the how much. Well, it’s kind of the same answer and is connected with how easy a food is to eat. It’s really easy to eat 500 g of almonds (3110 calories - almost twice as much as a female needs to eat in a whole day), but if you tried to eat 500 g of cucumber (50 g), you would struggle. It’s a similar situation with sugary foods. A small amount packs a lot of energy.
So in summary, the weight gain normally happens because you eat too much of foods that contain a lot of energy (so a combination of what you eat and how much).