Since valence shells in nonmetal atoms are almost full, the atoms attract electrons and hold them tightly to fill their valence shells.
They have free electron(s) on their outermost energy levels making them good conductors.
They have metallic bonds in their chemical structure.
They readily lose the electrons on their outermost energy levels, to bond with non-metals in ionic bonds to form chemical compounds called "salts"
Mg (s) + HCl (aq) → MgCl₂(s) + H₂(g)
Looking at the equation :
We have 1 Mg at the left hand side and 1 Mg as well on the right hand side.
So that is balanced.
We have 1 H at the left hand side and 2 H on the right hand side.
So that is not balanced. Same for Chlorine. Cl.
We add 2 to the HCl on the left hand side and that balances it.
Mg(s) + 2HCl(aq) → MgCl₂(s) + H₂(g)