From a physics point of view, calories are energy. If you dont burn more energy in a day than you eat, your body metabolises it and tucks it away as fat.
If you dont eat enough calories however, and you dont eat enough to provide just enough energy the body needs, then it will eat into your muscle for its energy.
Its basically a by product, in electronics, whatever voltage something doesnt need it gives off as heat. But the human body is far more efficient aslong as your metabolism is up to speed. THe more cardio you do the higher the rate your metabolic rate is, hence olympic swimmers are lean and couch potatos are fat.