Hint $\ f^2,f^3\in \Bbb R[x]\,\Rightarrow\, f = f^3/f^2 \in \Bbb R(x)\,$ so $\,f^2 \in \Bbb R[x]\,\,\Rightarrow\,f \in \Bbb R[x]\, $ by the Rational Root Test (which works over any UFD, with same proof as in $\,\Bbb Z)$
More explicitly if $\,f^2 = p\in \Bbb R[x]\,$ then $\,f\,$ is a root of the monic $\,y^2 - p\in S[y]$ over the UFD $\,S = \Bbb R[x],\,$ so by RRT the reduced denominator of $\,f\,$ divides the lead coef $= 1\,$ of $\ y^2 - p.\ $ Hence the denominator of $\,f\,$ is a unit, i.e. the polynomial fraction $\,f\,$ is "integral", i.e. $\,f\in \Bbb R[x].$
Remark $\ $ This is a polynomial analog of the classical irrationality proofs for square-roots of numbers. Most of the proofs for numbers will also work here (e.g. comparing the parity of exponents in the (unique) prime factorizations on both sides).