You get hydrochloric acid when you dissolve hydrogen chloride into water at percentages up to around 40 percent HCl. Although hydrochloric acid reacts with many compounds, its elemental reactions stand out with regards to metals — by itself, hydrogen chloride reacts with many metals, particularly those closer to the left side of the periodic table.
TL;DR (Too Long; Didn't Read)
Hydrochloric acid (HCl) reacts readily with most metals other than those in the platinum group in the periodic table. Generally, the metals at the far left of the periodic table react most strongly, and as you progress towards the right side, reactivity lessens.
Alkaline metals, the first group in the periodic table, like lithium, sodium and potassium, will react with even cold water — breaking the H2O molecules apart to create a metallic oxide and elemental hydrogen gas. Hydrochloric acid, however, will also react with these metals — for instance, two molecules of hydrochloric acid and two atoms of metallic sodium will react to produce two molecules of sodium chloride (table salt) and one molecule of hydrogen gas.
Alkaline Earth Metals
The alkaline earth metals, the second group in the periodic table, have varying degrees of activity, but will all generally react with water or steam. These metals — beryllium, magnesium, calcium and strontium — react with hydrochloric acid to form a chloride and free hydrogen. Metallic magnesium when combined with hydrochloric acid, will naturally result in magnesium chloride -- used as a dietary supplement -- with the hydrogen being released as a gas.
Iron, cadmium, cobalt, nickel, tin and lead do not react with water, but hydrochloric acid will dissolve them, displacing the hydrogen from the HCl. Iron reacts with hydrogen chloride to produce iron chloride, FeCl2 — sometimes known as ferrous chloride. Like another iron chloride compound, FeCl3, ferrous chloride is used in waste water treatment, helping to remove suspended particles in the water. Chlorides of cadmium, cobalt, nickel and tin find uses in electroplating — a process that deposits a very thin layer of the metal onto another surface.
Metals in higher groups than lead are generally not dissolvable by hydrochloric acid alone, but combined with nitric acid to produce aqua regia (Latin for "royal water"), results in an extremely corrosive solution so called because it can dissolve even "royal" metals like platinum and gold. Metal refiners, for example, use this process to produce extremely high purity gold — like that found in bullion coins -- gold or silver coins that are kept safe as an investment, rather than being used as ordinary currency. Chemists also use aqua regia to clean laboratory equipment, since it will remove nearly any contaminant.