In order for your cells to break down sugar molecules made of hydrogen and carbon atoms, they have to combine the sugar with oxygen, just like wood needs oxygen to make a fire and iron needs oxygen to rust. That’s why you have to breathe to stay alive: without oxygen, your body can’t break down sugar to make energy to keep you going.
Your cells mix oxygen molecules with sugar molecules and get an oxidation reaction – a slow reaction where the atoms combine in new ways to make carbon dioxide molecules and water molecules, with some leftover energy. The cells then poop out the carbon dioxide molecules, along with any water they don’t want, into your blood. Your blood carries the carbon dioxide molecules to your lungs and you breath it out. It carries the water to your kidneys, for you to get rid of as pee. The cell keeps the energy to use itself.
Digestion gives off just the same amount of energy as burning the same amount of food in a fire. Inside your body, though, you use that energy to power your muscle cells and keep your heart beating and your brain working, instead of using it to make a fire. But there’s still plenty of heat from the oxidation reaction to keep you warm, too.