Below is a *complete, rigorous* elementary proof - easily comprehensible to a high-school student.

We show $\rm\,(2,x) = (f)\, $ in $\rm\,\mathbb Z[x]\,$ yields a *parity* contradiction, by simply *evaluating* polynomials.

$\rm\ \ f\, \in\, (2,x)\, \Rightarrow\, f\, =\, 2\, G + x\, H.\: $ Eval at $\rm\, x\! =\! 0\ \Rightarrow\ \color{#0a0}{f(0)} = 2\,G(0) = \color{#c00}{2n}\,$ for some $\rm\: n\in \mathbb Z$

$\rm\ \ 2\, \in\, (f)\ \Rightarrow\ 2\, =\, f\, g\:\ \Rightarrow\ deg(f) = 0\ \ \Rightarrow\ \ \color{#c00}f\ =\ \color{#0a0}{f(0)}\ =\ \color{#c00}{2n}$

$\rm\ \ x\, \in\, (f)\,\ \Rightarrow\,\ x\ =\ \color{#c00}f\, h\ =\ \color{#c00}{2n}h.\,\ $ Eval at $\rm\ x\! =\! 1\ \Rightarrow\ 1\, =\ 2n\,h(1)\ \Rightarrow\ 1\,$ is even $\, \Rightarrow\!\Leftarrow$

**Remark** $\ $ The above proof works over any domain where $\,2\ne 0\,$ and $\rm\,2\,$ is not a unit. $ $ i.e. $\rm\:2\nmid 1.\:$ In particular, it works over any domain with a nontrivial sense of parity, i.e. having $\rm\:\mathbb Z/2\:$ as ring image, e.g. the Gaussian integers, or the rationals writable with odd denominator - see this post. Conversely, the result is false if $\rm\,2 = 0\,$ or a unit since then $\rm\,(2,x) = (x)\,$ or $\,(1)\,$ *is* principal.

Further, the proof still works if we replace $\,2\,$ by any element $\,c\,$ of the coefficient domain $\,D,\,$ yielding: $\ (c,x)\,$ is principal in $\,D[x]\iff c=0\,$ or $\,c\,$ is a unit. Therefore we deduce

**Theorem** $ $ If $\,D\,$ is a domain then $\,D[x]\,$ is a PID $\iff D\,$ is a field.

since the direction $(\Leftarrow)$ is well-known via the Euclidean algorithm.

See here for generalizations to coeff rings from domains to rings.