Galvanized metal does rust eventually, but it can take decades. Metal is galvanized by adding a thin layer of zinc to its surface. The zinc forms a barrier between atmospheric oxygen and the underlying iron or steel. This generally prevents rust.
The zinc coating of galvanized metal can continue to protect the underlying metal even when a scratch forms in the topcoat. It does this by transferring electrons through electrolytes, usually from rain, and oxidizing more quickly than iron could alone. This rapid zinc oxidation prevents ferrous metals from rusting until the zinc has exhausted its free-electron capacity or the protective coating has worn away. Zinc-based rust coats used on vehicle chassis usually last for decades.