How did we get $2\pi - x$? Kindly provide a general answer because many other similar questions have the same issue.
First, $\arccos (\cos x)\ne x$ in your case because $x$ is defined to be from $(\pi, 2\pi)$ and range of $\arccos x$ is $[0,\pi]$, that is $\arccos x$ cannot return values you want - it cannot return $x$.
That is why we have to shift $x$ in range of $[0,\pi]$. We can do that by letting $y=2\pi-x$. Remember that $\cos(2\pi-x)=\cos x$, so we did not change original equation.
Now, since $y\in [0,\pi]$ we can write $\arccos (\cos y)=y$ or $\arccos(\cos (2\pi-x))=2\pi-x$ or (final answer) $\arccos (\cos x)=2\pi-x$.