Burning means reaction with oxygen.
We know that metals react with oxygen to form basic oxides except some metals which form amphoteric oxides.
But magnesium burns in presence of oxygen that is reacts with oxygen to form magnesium oxide(MgO) which is basic in nature.