Answer
The solution is
$$f(x)=x^2-6.$$
Work Step by Step
We need that $(f(x))^2$ is equal to a 4th degree polynomial so we will demand that $f(x)$ is a 2nd degree polynomial i.e. that it is given by $f(x)=ax^2+bx+c$. This gives
$$(f(x))^2=(ax^2+bx+c)^2=a^2x^4+b^2x^2+c^2+2abx^3+2acx^2+2bcx = a^2x^4+ 2abx^3+(b^2+2ac)x^2+2bcx+c^2 = x^4-12x^2+36.$$
Equating the coefficients multiplying same powers of $x$ we get
$$a^2=1\Rightarrow a=1$$
$$2ab=0\Rightarrow 2b=0\Rightarrow b=0$$
$$b^2+2ac=-12\Rightarrow 2c=-12\Rightarrow c=-6$$
The last equation is only for checking. Indeed
$$c^2=(-6)^2=36.$$
Finally
$$f(x)=x^2-6.$$