Why metals release hydrogen gas?

Metals will release hydrogen gas when reacting with an acid (or in some cases, water). This is because acids contain hydrogen, and many metals are higher on the reactivity series than hydrogen, meaning they will replace it in a compound. For example, zinc reacts with hydrochloric acid

Zn + 2HCl --> ZnCl2 + H2

The zinc replaces hydrogen in the hydrochloric acid, forming zinc chloride and releasing elemental hydrogen in the process.