If you eat only once a week or once a month, your body will hold on to all the calories it can as a hedge against starvation. Of course, now that you have 24-hour supermarkets and pizza delivery, starvation is the least of your worries.
Your body is extremely efficient. It extracts and uses the energy it needs from the food you eat and converts the excess into fat, which it then stores in your body. Too many calories equal excess fat.
But all calories are not equal (the laws of thermodynamics aside). After all, human bodies aren't machines made out of metal and moving parts; every body is different. For example, simple carbs and sugars trigger insulin responses in the body, which tell it to store fat. In some people, this response is very easy to trigger; as a result, a high-carbohydrate diet makes them put on weight. On the other hand, for most people, the body has to work harder to digest proteins than it does to digest carbs, which means they gain less weight on a high-protein diet.