Is $\sqrt{x^2} = (\sqrt x)^2$? Take $x=4$ for example:
$ \sqrt{(4)^2} = \sqrt{16} = \pm4 $
However:
$ (\sqrt{4})^2 = \sqrt{\pm2}$ 
Case 1: $ (-2)^2 = 4$ 
Case 2: $ (2)^2 = 4$
Solution : $+4$
How come the $ \sqrt{(4)^2} = \pm4$; but $ (\sqrt{4})^2 = 4 $ ? 
What is missing?
 A: Disclaimer: In the following we restrict ourselves to real numbers, not taking complex numbers and the like into consideration.

By convention, the square root of a positive number $t$, written as $\sqrt t$, has been defined to be the positive solution to the equation $x^2=t$. This gives meaning to the following way of specifying the two solutions (for positive $t$):
$$
x^2=t\iff x\in\{\sqrt t,-\sqrt t\}
$$

With this your example becomes $\sqrt{4^2}=4$ and $(\sqrt 4)^2=4$, but on the other hand we have $\sqrt{(-4)^2}=4$ whereas $(\sqrt{-4})^2$ is undefined, because $\sqrt{-4}$ is undefined, since $x^2=-4$ has no solutions.

In general, $\sqrt{x^2}$ agrees with $(\sqrt x)^2$ for non-negative input $x$, whereas only the first is defined for negative values of $x$.
A: In general:
$$\sqrt{x^2}=|x|\implies \sqrt{x^2}=\left(\sqrt{|x|}\right)^2=|x|$$
A: For your example you miss that $x\mapsto \sqrt{x}$ is a function and thus have only one image, this image is nonnegative.
By the way: a huge difference between the functions 
$$f(x)=\sqrt{x^2}$$ and $$g(x)=(\sqrt{x})^2$$ 
is their domain of definiton. While $f$ id defined on $\Bbb R$, $g$ is only defined on $[0,\infty)$. In particular, $f$ is not bijective in opposition to $g$.
A: $\sqrt{x^2} = \sqrt{x \cdot x} = \sqrt{x} \cdot \sqrt{x} = \sqrt{x}^2$
A: This holds provided $x\ge 0$.  What you see here is the specification of rules.  To specify a function fully, you must specify its domain and codomain.  $x\mapsto\sqrt{x^2}$ makes sense on $\mathbb{R}$.  $x\mapsto\left(\sqrt{x}\right)$ makes sense only for $x\ge 0$. So unless you slice off domain, these functions are inequivalent.
