This is not always true. Certain diseases, e.g. PCOS (Poly Cystic Ovarian Syndrome) and (general) insulin resistance mean that eating X calories (assuming X is lower than the calories expended on exercise, and basal metabolic rate) will just make you extremely tired and unproductive. In these diseases, the body is unable to utilize the energy that you are consuming and unable to burn the energy you have stored already.
I'm not suggesting that all causes of obesity are related to a disease, but things are definitely not so cut and dry as expend more energy than you consume and you will lose weight. The body is an exceedingly complex system of chemical reactions which are fairly tightly regulated (see topics around MCA - Metabolic Control Analysis, to understand how systems of reactions don't behave intuitively). Changing one input variable does not always yield the result you are looking for when you simplify the entire human metabalome down to an equation of calories in, fat storage and calories out