Why can't I do $u$ substitution on $\int \cos^4x dx$? I tried to rewrite the integral as $$\int (\cos^2x)(\cos^2x)dx$$ which in turn I used the trig identity of $\cos^2x = 1 - \sin^2x$ and therefore changed $$\int (\cos^2x)(\cos^2x)dx = \int (1 - \sin^2x)(1 - \sin^2x)dx = \int ( \sin^4x - \sin^2x + 1) dx$$
I then tried to do u substitution where $u=\sin x$ and $du=\cos x dx$
But my answer was completely wrong...I ended up getting $$\frac{\sin^5x}{5}+\sin x-\frac{2\cos^3x}{3}+K, \quad K\in \mathbb R$$
Am I doing $u$ substitution wrong or is there a better way to solve this integral?

Your substitution is not correct. Here are some steps for solving given integral:
$$\cos^4x = (\cos^2x)^2, \quad \cos^2x = \frac{1+\cos2x}{2}.$$
Thus, we can write:
$$\cos^4x = \frac{1 + 2\cos2x + \cos^22x}{4}=\frac{1}{4}+\frac{1}{2}\cos2x+\frac{1}{4}\cos^22x.$$
Now, we will apply once again a formula for square of cosines:
$$\cos^4x = \frac{1}{4}+\frac{1}{2}\cos2x+\frac{1}{4}(\frac{1+\cos4x}{2})=\frac{1}{4}+\frac{1}{2}\cos2x+\frac{1}{8}+\frac{1}{8}\cos4x.$$
The solution for given integral is now easy to obrain...
