How can chlorine have an oxidation number of 3 in chlorite?
Chlorine has to have an oxidation state of $+3$.
But if you look at the periodic table chlorine is in 7th period which means it has 7 electrons in valence so it gains one electron while reacting. Getting oxidized by definition means losing electrons so an oxidation state of $+3$ means chlorine is losing 3 electrons. I just can't get my head around why would chlorine do that? Or am I calculating the oxidation state wrong?
It is indeed in the +3 oxidation state. Keep in mind, though, that that does not mean chlorine lost three electrons. That polyatomic ion is not made up of smaller ions.
First and foremost, please remember that an oxidation state is simply a book-keeping method that assumes that all bonds between atoms are ionic in nature.
In the chlorite ion, we know that the bonds between chlorine and oxygen are covalent in nature.
Therefore, when we say that chlorine has an oxidation state of +3 we do not mean that the chlorine atom has transferred three electrons to the oxygen atoms, as that would imply that the reality of the nature of the bonds between oxygen and chlorine is ionic.
Chlorine can indeed have an oxidation state of +3. Infact, it has multiple oxidation state to a maximum of +7. This is because chlorine is able to engage its d-orbital by hybridization, in which an electron in a lower energy level of may be an s-orbital or any other orbital below the d-orbital, reaches an excited state where it is promoted to a higher energy level which is the d-orbital. The d-orbital has an orbital orientation of 5. I hope this helps.
What is the oxidizing agent for Fe in the following redox reaction?
Why can Cu have an oxidation number of +2?