Energy imbalance; i.e. net positive energy intake.
Simple example, you eat only protein and fat, you don't gain weight. You substitute some fat for carbohydrates and you suddenly go up in weight. This despite you just went down in calories.
You can also mess with your feeding window and loose weight. Simply cram in a days worth of calories over a few hours and eat nothing for the rest of the day and you'll likely loose weight do the opposite (eat several times during the day) and you gain weight. Assuming same total calorie count overall.