Let $$I=\displaystyle\int\sin^2x \ dx$$then
$$I=\displaystyle\int(1-\cos^2x) \ dx=x+C-\displaystyle\int \cos^2x \ dx$$
Using the substitution $x=x+\frac{\pi}{2}$ we get
$$I=x+C-\displaystyle\int\cos^2(x+\frac{\pi}{2}) \ dx=x+C-\displaystyle\int\sin^2x \ dx$$
and thus $I=\frac{x}{2}+C$ which is obviously wrong.
So where's the mistake in the above argument??
You cannot say that $x=x+\pi/2$. This makes no sense mathematically.
It would be better to use $$\sin^2 x = \frac{1-\cos(2x)}{2}$$
Result: $$I=\frac{x}{2}-\frac{\sin(2x)}{4}+C$$