Are they equal?
-5 = $\sqrt{(-5)^2}$
Square root always gives a positive result.
Hence the result for your question i.e.,$\sqrt{25}$ is $5$.
But if the question were, $a^2 = (-5)^2$ , then $a = +5$ (or) $-5$
As you are probably aware of, there are two solutions to the equation:
$$x^2 = 25$$
namely $x = \pm 5$. For $n > 0$, the radix $\sqrt{n}$ is defined to be the positive solution to $x^2 = n$. So in this case, $\sqrt{(-5)^2} = \sqrt{25} = 5$.
The other solution to $x^2 = 25$, i.e. $x = -5$, is written $-\sqrt n$ in general.
The motivation for the definition of the function $\sqrt{x}$ is simply as the inverse of the function $x^2$.
But the function $f(x)=x^2$ is even and hence is not one one. And hence the inverse function should return you two values. But just to make the inverse function actually a function(a relation which have all members in the domain having exactly one image) we define $\sqrt{x}$ as a function which gives you the positive root .
So most generally the inverse of the function $f(x)=x^2$ (let's call the inverse as $g(x)$ is defined this way $$g(x)= {\begin{cases}\sqrt{x}\quad \\ -\sqrt{x} \end{cases}} $$
And the answer to the original question, as I have mentioned before $\sqrt{x}$ gives you only positive values and hence $\sqrt{(-5)^2}=5$ .
There is a general rule : $\sqrt{x^2} = |x|$ for all real $x$.
So we have $\sqrt{(-5)^2} = |-5| = 5$.