When magnesium is added to hydrochloric acid a chemical reaction will happen. Where magnesium replace hydrogen in hydrochloric acid forming magnesium chloride and hydrogen gas. This is a single replacement reaction where one element replace another element in a compound.