$\log_7 (5x^2) \ne 2 \log_7 (5x)$ because $x$ is being squared, not $(5x)$.
In actuality: $\log_7(5x^2) = \log_7 5 + \log_7 x^2 = \log_7 5 + 2\log_7 x$
[Assuming $x > 0$. Otherwise we should assume $\log_7 x^2 = \log_7 (-x)^2 = 2\log_7 |x|$].
Whereas had the question been instead $\log_7 (5x)^2$ then $\log_7 (5x)^2 = 2\log_7 5x$.
In answering the question, the text is assuming you, the student, will make an error and say "Well, gosh.... Isn't $\log_7(5x^2) = \log_7 (5x)^2 = 2 \log_7 5x$?" (Presumably right before you eat dirt and shove a crayon up your nose).
In which case the book is shaking its head sadly and the sorry excuse it presumes its students must be, and explains that, no $5x^2=5*(x)^2 \ne (5x)^2 $ but $5x^2 = ([\sqrt 5] x)^2$ so $\log_7(5x^2)$ would actually by $\log_7(5x^2) = \log_7([\sqrt 5]x)^2 = 2\log_7([\sqrt 5] x)$ (And as Adam points out in a comment you book would still be wrong if we don't know $x > 0$).
So that you didn't see where the $\sqrt 5$ came from just means you aren't as dumb as the book assumes you to be.
Note: $\log_7 5 + 2\log_7 |x| = 2\log_7 \sqrt 5|x|$ (and $\log_7 5 = \log_7 \sqrt 5^2 = 2\log_7 \sqrt 5$) but the RHS is certain less natural and more convoluted than the LHS.