Here's why:
* Metals tend to lose electrons, becoming positively charged ions (cations).
* Nonmetals tend to gain electrons, becoming negatively charged ions (anions).
The electrostatic attraction between these oppositely charged ions is what forms the ionic bond.