The case $\int x^2\,dx$ serves to illustrate a more general point, so I'll go out of my way to use $u$-substitution.
Select $u=x^2$. Then $$ \frac{du}{dx} = 2x \iff \frac{du}{2x}=dx\,. $$ Substituting we get $$ \int \frac{u}{2x}\,du\,. $$ But there's still an $x$ lingering. We can get rid of this by also substituting $x=\pm \sqrt{u}$: $$ \begin{split} \pm \int \frac{u}{2\sqrt{u}}\,du & = \pm \frac{1}{2} \int \sqrt{u}\,du\\ & = \pm \frac{u^{3/2}}{3}+c\\ & = \pm \frac{x^3}{3}+c \end{split} $$ So this still came out right. My question is: what's up with the $\pm$? I can't find a persuasive reason to just discard it.
Your last line is incorrect: you substituted "$\color{red}{x=\sqrt{u}}$" instead of $x=\pm\sqrt{u}$. Here's a corrected back substitution for $\pm u^{3/2}$: $$\pm u^{3/2}=\pm u^1\cdot u^{1/2}=\pm u\cdot\sqrt{u}=\pm x^2\cdot(\pm x)=+x^3.$$
UPDATE: By virtue of defining $u=x^2$, $u$ is automatically a non-negative quantity. Now, saying "$x=\pm\sqrt{u}$" does NOT define a function — instead, it defines two different functions, in the sense of being two different cases that we now have to consider.
Case 1: $x\ge0$. Then $x=+\sqrt{u}$ or equivalently $\sqrt{u}=+x$, and your answer (with the same "$+$" in front) is: $$+u^{3/2}=u^1\cdot u^{1/2}=u\cdot\sqrt{u}=x^2\cdot(+x)=x^3.$$
Case 2: $x<0$. Then $x=-\sqrt{u}$ or equivalently $\sqrt{u}=-x$, and your answer (with the same "$-$" in front) is: $$-u^{3/2}=-u^1\cdot u^{1/2}=-u\cdot\sqrt{u}=-x^2\cdot(-x)=x^3.$$
So it's $x^3$ either way.