Oxidation: The process in which an atom loses electrons.
When magnesium reacts with hydrochloric acid (HCl), it loses two electrons Mg2+ which results in the formation of magnesium chloride (MgCl2).
So, Mg is getting oxidised in this reaction.