The acid has reacted with the iron in the nail and has started to eat it away. The nail has rusted or corroded. A metal corrodes whenever a chemical attacks its surface. Water, air, and acid are three of the most common corroding chemicals.
Acid fumes from burning coal and oil dissolve in rain water to make acid rain. Acid rain causes lots of damage by corroding metals. Metals first lose their shiny surface then as more is removed they lose their strength.
Hydrochloric acid is the most difficult to treat from the corrosion and building materials standpoints of the specific acids. Extreme care is required in selecting materials to handle the acid on its own, even in quantities that are fairly diluted or in process solutions that contain significant amounts of hydrochloric acid.