How can chlorine have an oxidation number of 3 in chlorite? I am studying redox reactions right now and I'm a bit confused about something:
$\ce{ClO2^-}$ is a compound ion and in a compound ion the sum of oxidation state of participating ions has to be equal the charge on compound since $\ce{ClO2^-}$ has a whole charge of $-1$ the oxidation state sum of $\ce{Cl}$ and $\ce{O2}$ must be $-1$, right? Oxygen has an oxidation state of $-2$ so $\ce{O2}$ will have 
\begin{align}
2\cdot -2 &amp;= -4\\
-4 + x &amp;= -1\\
x &amp;= -1 + 4\\
x &amp;= 3\\
\end{align}

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.