Compute $\left(-\sqrt{5321}\right)^2$.
First, we note that $(-a)^2 = a^2$ for any number $a$, so we have \[\left(-\sqrt{5321}\right)^2 = \left(\sqrt{5321}\right)^2.\] Next, for any nonnegative number $n$, the value of $\sqrt{n}$ is the number whose square is $n$.  So, when we square $\sqrt{n}$, we get $n$.  Therefore, $\left(\sqrt{5321}\right)^2 = \boxed{5321}$.