Comparing two limsup's
No, this equality does not hold in general. What is true is that rhs is at most twice as large as lhs and this is sharp.
For the sake of brevity I will only show an example where lhs is $1$ and rhs is greater than $1.9$. Choose a very fast growing sequence $a_n \ge 1$. We will construct our function on each interval $I_n = [a_n, a_{n+1}]$ separately.
Let $f(x) = \frac{1}{100a_n}$ on $[a_n, 100a_n)$ and $f(x) = \frac{1}{x}$ on $[100a_n, a_{n+1})$ (on $[0, a_1]$ say $f(x) = 1$).
Obviously $\limsup xf(x) = 1$ ($f(x) \le \frac{1}{x}$ for $x > a_1$).
We have $$\frac{1}{f(a_n)}\int_{a_n}^\infty f(x)^2dx \ge 100a_n(99a_n\frac{1}{10000a_n^2} + \frac{1}{100a_n} - \frac{1}{a_{n+1}}) = 1.99 - \frac{100a_n}{a_{n+1}} \ge 1.9,$$
where in the first inequality we truncated integral at $a_{n+1}$ and the last inequality is true if $a_{n+1} \ge 10^9a_n$.
Therefore rhs is at least $1.9$. It is easy to make rhs to be equal to $2$ with the same method. Turns out this is sharp:
Again for brevity I will prove that if lhs is less than $1$ then rhs is at most $2$. For big enough $x$ we have $f(x) \le \frac{1}{x}$. Therefore
$$\frac{1}{f(x)}\int_x^\infty f(t)^2dt \le \frac{1}{f(x)}(\int_x^{\frac{1}{f(x)}}f(x)^2dt + \int_{\frac{1}{f(x)}}^\infty \frac{1}{t^2}dt) \le \frac{1}{f(x)}(f(x) + f(x)) = 2.$$
Assuming lots of stuff, just to get the ball rolling:
$$\frac{1}{f(x)}\int_{x}^{\infty}f^{2}(t)dt=\frac{1}{xf(x)}\frac{\int_{0}^{\frac{1}{x}}f^{2}(\frac{1}{t})\frac{1}{t^{2}}dt}{\frac{1}{x}}.$$
So we claim that
$$(xf(x))^{2}\sim \frac{\int_{0}^{\frac{1}{x}}f^{2}(\frac{1}{t})\frac{1}{t^{2}}dt}{\frac{1}{x}}.$$
If $f^{2}(1/t)/t^{2}$ was continuous, then
$$\frac{\int_{0}^{\frac{1}{x}}f^{2}(\frac{1}{t})\frac{1}{t^{2}}dt}{\frac{1}{x}}\sim f^{2}(x)x^{2}\frac{1/x}{1/x}=f^{2}(x)x^{2}.$$
So maybe getting a counterexample by making $f^{2}(1/t)/t^{2}$ not well-behaved eg. blowing up at $t=0$ i.e. $f(x)>\frac{1}{x}$.