How are Cos²X and Cos X² and Cos (X)² all differ derivative wise?!
Outside CAS no one uses $\displaystyle \cos(x)^2$. So there is no reason to be confused,
The derivative of $\displaystyle \cos^2(x)$ is $\displaystyle -2\cos(x)\sin(x)~.$
The derivative of $\displaystyle \cos(x^2)$ is $\displaystyle -2x\sin(x^2)~.$
BTW. Because these are functions most of us insist that () be used.
I will mark $\displaystyle \cos~x$ as wrong.