I would guess that you are just seeing the effects of a dynamical system with a hyperbolic fixed point. Consider the matrix equation $$ A'(x) = \begin{pmatrix} 0 & 1\\ -\cos(x) & 0\end{pmatrix} A(x) $$ with initial condition $A(0) = I_2$. This fundamental solution clearly satisfies $$ A(x+2\pi) = A(x)A(2\pi) $$ where $$ A(2\pi)\approx \begin{pmatrix} -8.065 & 14.509\\ 4.414 & -8.065\end{pmatrix}, $$ a matrix that has eigenvalues $\lambda\approx -16.068$ and $1/\lambda\approx -0.062$. (Note that the ratio of the eigenvalues is about $\lambda^2 \approx 258$.) The action of $A(2\pi)$ on $\mathbb{R}^2$ is hyperbolic, contracting along the $1/\lambda$-eigenspace and expanding along the $\lambda$-eigenspace.
Now, the general solution of your equation satisfies
$$
\begin{pmatrix}y(x)\\y'(x)\end{pmatrix}
= A(x)\begin{pmatrix}y(0)\\y'(0)\end{pmatrix},
$$
so
$$
\begin{pmatrix}y(x+2k\pi)\\y'(x+2k\pi)\end{pmatrix}
= A(x)A(2\pi)^k\begin{pmatrix}y(0)\\y'(0)\end{pmatrix},
$$
and if the initial condition is very near (but does not lie in) the $1/\lambda$-eigenspace of $A(2\pi)$, it will take a few cycles of $2\pi$ for the very small $\lambda$-eigenvector component to grow, but once it does, it will become exponentially dominant. I'm guessing that your boundary values just happen to have hit on such an initial condition.