Na is a cation, meaning it needs to lose electrons to gain a full outer shell. Since it is an alkaline metal, it has a charge of +1. (Cations are positive and need to lose electrons.).
Cl is an anion, meaning it needs to gain electrons to gain a full outer shell. Since is is a halogen, it has a charge of -1. (Anions are negative and need to gain electrons).