Acids react with metals to produce a salt and hydrogen gas. This can be shown in a word equation:
Acid + Metal Salt + Hydrogen
Not all metals react with acids - unreactive metals such as gold and platinum do not react with acids, but metals such as magnesium and zinc react very vigorously with acids. Some metals, such as sodium, are so reactive that they should never be placed into acid.
When a small piece of magnesium metal is added to hydrochloric acid, lots of bubbles of hydrogen gas are produced and the conical flask becomes hot. The hydrogen gas can be collected and tested.
Hydrogen gas is explosive and when a small volume is collected and ignited a 'squeaky' pop is produced. This is the test for hydrogen gas, but this should only be performed with small volumes as large volumes will result in large explosions.