Here's why:
* Sodium (Na) has one valence electron, which it readily *loses* to achieve a stable electron configuration.
* Chlorine (Cl) has seven valence electrons. It readily *gains* one electron to achieve a stable electron configuration.
The combination of sodium and chlorine forms sodium chloride (NaCl), or table salt, because of this difference in their tendencies:
* Sodium loses an electron to become a positively charged sodium ion (Na+).
* Chlorine gains an electron to become a negatively charged chloride ion (Cl-).
These oppositely charged ions are attracted to each other, forming an ionic bond and the compound sodium chloride.