If we substitute $x=\sin \theta$ then we get the derivative to be $\frac{1}{\sqrt{1-x^2}}$ shown in the picture below
But instead of assuming $x=\sin \theta$ if we assume $x=\cos \theta$ we get the answer to be $-\frac{1}{\sqrt{1-x^2}}$. Why the answers are different in this case? Where is the mistake here?

Actually, $$\frac{d}{dx}\left(\sin^{-1}\left(\frac{x+\sqrt{1-x^2}}{\sqrt{2}}\right)\right)=\frac{\sqrt{1-x^2}-x}{|\sqrt{1-x^2}-x|}\frac{1}{\sqrt{1-x^2}}.$$
See WolframAlpha.
So, the derivative is equal to $\frac{1}{\sqrt{1-x^2}}$ if $\sqrt{1-x^2}-x>0$ that is if $-1<x<\frac1{\sqrt2}$ and $-\frac{1}{\sqrt{1-x^2}}$ if $\frac1{\sqrt2}<x<1$.
Note also that when you substitute $x=\cos\theta$, you may get $\frac{\pi}{4}-\theta$ for the expression if you accept that $\sqrt{1-\cos^2\theta}=-\sin\theta.$