Dear student,
Matter is something that has mass and occupies space. The flame is the mixture of gases and so is a matter. The light produced by the flame is energy , not matter and heat produced is also energy.
thus fire is a chemical reaction that happens in a mixture of gases.
Regards!