Metals which are above hydrogen in the reactivity series will react with dilute hydrochloric or sulfuric acid to produce a salt and hydrogen.
metal + acid → salt + hydrogen
magnesium + hydrochloric acid → magnesium chloride + hydrogen
Mg (s) + 2HCl (aq) → MgCl₂ (aq) + H₂ (g)
This is a displacement reaction.
There is a rapid fizzing and a colourless gas is produced. This gas pops with a lighted splint, showing the gas is hydrogen.
The reaction mixture becomes warm as heat is produced (exothermic).
The magnesium disappears to leave a colourless solution of magnesium chloride.
If more reactive metals are used instead of magnesium the reaction will be faster so the fizzing will be more vigorous and more heat will be produced.