The atomic number of an element is the number of protons in the nucleus of its atoms. In a neutral atom the number of electrons is the same as the number of protons. Electrons are arranged in shells, with up to two in the first shell and up to eight in the next two shells for the first 20 elements. This is the electronic structure of the atom.
The electronic structure tells you where an element is in the Periodic Table. The number of electrons in the outer shell is the group number, and the number of occupied shells is the period number. The electronic structure of sodium is 2,8,1. It has one electron in its outer shell, so it is in Group 1, and it has three occupied shells, so it is in Period 3.
Atoms react to get a full outer shell, because this is a stable arrangement. Metals react by losing their outer electrons to form positive ions. Non-metals react by gaining electrons to form negative ions, or by sharing electrons. Chlorine has atomic number 17, so its electronic structure is 2,8,7. It has seven outer electrons, so it gains one electron to form a negative ion.
Elements in the same group have the same number of outer electrons, so they have similar reactions. Group 1 elements are reactive because the one outer electron is easy to lose. Group 0 elements, the noble gases, are unreactive because their outer shell is already full, so they do not need to gain, lose or share electrons. In every reaction only the electrons change. The nucleus of the atom does not change.