Answer
$$ f(x)= x^2-2x$$
Work Step by Step
Given
$$x f^{\prime \prime}(x)+f(x)=x^{2}$$
Since the R.H.S is a polynomial of degree $2$, then consider
\begin{align*}
f(x)&= ax^2+bx+c\\
f'(x)&=2ax+b\\
f''(x)&=2a
\end{align*}
Then
\begin{align*}
x f^{\prime \prime}(x)+f(x)&=x^{2}\\
x(2a)+(ax^2+bx+c)&= x^2\\
ax^2+(b+2a) x+c&=x^2
\end{align*}
By comparing, we get
$$a=1 ,\ \ c=0,\ \ b=-2 $$
Hence
$$ f(x)= x^2-2x$$