Hint $\ $ Most all proofs showing $\sqrt{p}$ irrational also work to show that $\sqrt{x^2+1}$ is an irrational polynomial, i.e. not a quotient of polynomials, e.g. compare parity of exponents of the prime $\,p = x^2+1\,$ in $\, f^2 = pg^2\,$ using the uniqueness of prime factorizations. Or apply the Rational Root Test to deduce any rational (function) root $\,Y\,$ of $\ Y^2 - (x^2+1)\, =\, 0\,$ must have denominator dividing $\,1,\,$ so $\,x^2+1 = Y^2\,$ is the square of a polynomial, contradiction. Or employ Bezout's gcd identity as in the proof below. Most proofs using unique prime factorization generalize to any ring with this property (a UFD or possibly also to gcd domains), and most proofs using Bezout's gcd identity generalize to any PID.
Theorem $\quad \rm r = \sqrt{f}\;\;$ is a polynomial, $ $ if a rational function, $ $ for polynomial $\:\rm f\in\mathbb{Q}[x]$
Proof $\ \ $ Let $\rm\,\ \color{#0a0}{r = \large{\frac{a}b}},\ a,b\in{\Bbb Q}[x],\,\ \gcd(a,b) = 1\ \Rightarrow\ \color{#C00}{ad\!-\!bc \,=\, \bf 1}\;$ for $\:\rm c,d \in \mathbb{Q}[x]\,\ $ by Bezout, since $\,\Bbb Q[x]\,$ has Division with smaller remainder, so has a Euclidean gcd algorithm.
$\rm\color{#C00}{That\,}$ and $\rm\: r^2\! = \color{#90f}{\bf f}\:\Rightarrow\ \color{#0a0}{0\, =\, (a\!-\!br)}\, (c\!+\!dr) \ =\ ac\!-\!bd\color{#90f}{\bf f} \:+\: \color{#c00}{\bf 1}\cdot r \ \Rightarrow\ r \in \mathbb{Q}[x]\ \ \ $ QED
The proof easily generalizes to roots of monic quadratic polynomials (and to higher degrees).