We can evaluate the distribution function $F(y)$ of $Y := 1 - \cos(X)$ directly as follows.
To begin with, note that as $X$ ranges over $[0, 2\pi]$, the range of $Y$ is from $0$ (achieved at $X = 0$ or $2\pi$) to $2$ (achieved at $\pi$). Therefore, for $y < 0$, $F(y) = 0$ and for $y \geq 2$, $F(y) = 1$.
For $y \in [0, 2)$ (it is helpful to draw the graph of $x \mapsto \cos(x)$ on $[0, 2\pi]$ to determine the region $\{x \in [0, 2\pi]: \cos(x) \geq 1 - y\}$. Also keep in mind that the domain of $x \mapsto \arccos(x)$ is $[-1, 1]$ with range $[0, \pi]$, so mirroring is needed for angle that is greater than $\pi$):
\begin{align}
& F(y) = P[1 - \cos(X) \leq y] = P[\cos(X) \geq 1 - y] \\
=& P[X \in [0, \arccos(1 - y)] \cup [2\pi - \arccos(1 - y), 2\pi]] \\
=& \frac{\arccos(1 - y)}{\pi}.
\end{align}
To summarize, the distribution of $Y$ is given by
\begin{align}
F(y) = \begin{cases}
0 & y < 0, \\
\frac{\arccos(1 - y)}{\pi} & 0 \leq y < 2, \\
1 & y \geq 2.
\end{cases}
\end{align}
Taking derivative of $F$ yields the pdf of $Y$:
\begin{align}
f(y) = \begin{cases}
\frac{1}{\pi\sqrt{1 - (1 - y)^2}} & 0 < y < 2, \\
0 & \text{ otherwise.}
\end{cases}
\end{align}
A graph of $f$ looks as follows, which matches the histogram you simulated. As @Sycorax pointed out in the comment, this is Arcsine distribution with support $(0, 2)$.