what is the derivative of $\displaystyle cos^2 x$
You use the chain rule when you have a function of a function: y = f(g(x)).
You use the product rule when you have a product of two functions: y = f(x) times g(x).
Sometimes both rules can be used.
$\displaystyle y = \cos^2 x$ can be thought of as a function of a function: $\displaystyle y = (\cos x)^2$, that is, the square of $\displaystyle \cos x$. On the other hand .....
$\displaystyle y = \cos^2 x$ can be thought of as a product of two functions: $\displaystyle y = (\cos x) \times (\cos x)$.
So in this case it doesn't matter whether you use the chain rule or the product rule.
However, what would your plan be to differentiate $\displaystyle y = \cos^5 x$. Repeated use of the product rule? I hope NOT .....