When $\cos^2(x)$ is differentiated via the chain rule, its outcome is $-2\cos(x)\sin(x)$.
However when the double angle formula is applied to $\cos^2(x)$, it becomes $$\frac{1}{2}(1 + \cos(2x))$$ which when differentiated is just $-\sin(x)$. How can this be?
The derivative of the second expression is $$-\sin(2x),$$ not $-\sin(x)$ and it can because $$ \sin(2x) = 2\cos(x)\sin(x).$$