First, we must write our reaction:
1 Mg + 2 HCl ===> 1 MgCl2 + 1 H2 (BALANCED)
To balance this, we must know that on both sides of this reaction should appear the same number of atoms.
We only have to multiply 2 next to the HCl molecule. Therefore, we will have 1 Mg, 2 H, and 1 Cl on both sides of the reaction.