It's an application of the Pythagorean theorem. Remember that a square has all sides the same length. Then, the diagonal can be the hypotenuse of a right triangle and the square's two sides will be the triangle's legs.
(side length)^2 * 2 = (diagonal)^2
diagonal^2 = (5*sqrt(2))^2 = sqrt(50)^2 = 50
(side length)^2 * 2 = 50
(side length)^2 = 25
side length = sqrt(25) = 5