When a metal reacts with acids, displacement reaction take place to form a salt and hydrogen gas.
The general chemical equation for this reaction is:
Metal + Acid → Salt + Hydrogen gas
For example, when Sodium (Na) reacts with hydrochloric acid (HCl) then sodium chloride (NaCl) and hydrogen gas (H2) form.
2 Na (s) + 2 HCl (aq) → 2 NaCl (s) + H2 (g)
Zn(s) + 2HCl (aq) → ZnCl2 (aq) + H2 (g)
Non-metals do not react with acids because non-metals are themselves acceptors of electrons so there is no way they can donate electrons to the hydrogen ion of the acid.