Chlorine is the poisonous gas that combines with sodium to form table salt.
In its elemental form, chlorine is a pale yellow-green gas made of diatomic Cl₂ molecules. Sodium, by contrast, is a soft, highly reactive metal. When the elements react, sodium transfers an electron to chlorine, producing sodium ions and chloride ions.
Those oppositely charged ions arrange into the ionic compound sodium chloride, written as NaCl. Sodium chloride is the principal chemical in ordinary table salt. The reaction can be represented as 2Na + Cl₂ → 2NaCl and releases substantial energy.
The important distinction is between chlorine and chloride. Chlorine gas is hazardous and reactive, while chloride is the negatively charged ion found in sodium chloride and many body fluids. Table salt is generally obtained from deposits or seawater evaporation, not by mixing elemental sodium and chlorine in the kitchen.