The Magnesium actually reacts with oxygen in the air, is burnt and produces a bright light. The bright light emits a lot of heat so the reaction is exothermic.