While the act of going to the gym won't burn many calories, putting on muscle can drastically increase your baseline metabolic rate. 10lb of muscle (easily gained by a "newbie" who is eating well) will add about 1,500 calories per day to your baseline metabolic rate. That's a whole meal! (and that's just the calories burned by existing, not by recovery/muscle building, the workout itself, etc).
The body is remarkably good at maintaining homeostasis when losing weight. So as one gets lighter, the body becomes more efficient and burns less calories, requiring deeper and deeper reductions in consumption. Increasing muscle mass negates this.
Edit: @gduffy has a better source for how much energy a lb of muscle burns, which is "4.5 to 7.0 kcal/lb per day". So adding 10lb of muscle will increase caloric consumption by 450 - 700 Calories. So not quite a meal, but a solid 5 mile run.