Oh joy - chemistry.
Summary: your chemist-teacher is right if all-things are assumed constant; the teacher is WRONG for the real-ife application to humans.
A bit more detail:
Teacher may be discussing this from the perspective of the Laws of Thermodynamics. The key one that is relevant to this being that "energy", (and therefore matter), "can neither be created nor destroyed".
With everything else being equal, there is no doubt that eating less and moving more will result in weight loss. Every movement requires energy (and also increases entropy), so your teacher is correct - from a thermodynamic perspective.
And if human beings were always consuming energy to the same extent, and also using it to the same degree of thermodynamic efficiency, your teacher would also be correct in the real world, too.
However, this is where Teacher falls down: the human biological energy management system (call it "metabolism", if you like) varies enormously and is incredibly adaptable. The fact is, no-one just uses energy for moving mass - they use it to create heat, perform chemical work to maintain / grow their body, process foods, kill viruses, etc. etc. When you factor this in, your teachers' statement is simplistic, and misleading.
WiZlon (a Chemist, but not a teacher)