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 &= -4\\ -4 + x &= -1\\ x &= -1 + 4\\ x &= 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?