Here's the chemical equation for the reaction:
C + O₂ → CO₂
This reaction releases energy in the form of heat and light, which is why we see fire when something burns.