It's instructive to give a direct proof of $\,p\nmid A,B\,\Rightarrow\,p\nmid AB.\,$ Since $\,p\nmid A,B\,$ when reduced mod $p$ both have lead coefs $\,\color{#0a0}{a,b\not\equiv 0}\,$ so $AB\,$ has lead coef $\,\color{#c00}{ab\not\equiv 0}\,$ (by $\,p\,$ prime), hence $AB\not\equiv 0,\,$ i.e.
$\ \ \ \ \qquad{\rm mod}\ p\!: \ \ \ \begin{eqnarray}
&&\ 0\ \not\equiv\ A\ \equiv\, \color{#0a0}a\, x^j\! + \:\cdots,\quad\ \ \:\! \color{#0a0}{a\not\equiv 0}\\
&&\ 0\ \not\equiv\ B\ \equiv\, \color{#0a0}b\, x^k\! + \:\cdots,\quad\ \ \, \color{#0a0}{b\not\equiv 0}\\
\Rightarrow\,\ &&0 \not\equiv AB \equiv \color{#c00}{ab}\ x^{j+k}\! + \:\cdots,\, \color{#c00}{ab\not\equiv 0}\end{eqnarray}$
i.e. primes $\,p\in R\,$ remain prime in $\,R[x]\,$ because $\,\color{#0a0}{p\nmid a,b}\,\Rightarrow\ \color{#c00}{p\nmid ab}\,$ [prime divisor property] always persists when $\rm\color{#c00}{multiplying}$ $\rm\color{#0a0}{lead\ coef's}$. This is one form of Gauss's Lemma.
This is precisely an elementwise view of the structural sketched by Adam's (it's simply the proof of $\,D$ domain $\Rightarrow D[x]\,$ domain, in the special case that $\,D \cong R/p \cong R\bmod p,\,$ for $\,p\,$ prime).
Beware $ $ The "primitive" form of Gauss's Lemma depends crucially on $R$ being UFD. For if $R$ has an atom (irreducible) $\,p\,$ that is not prime then there exists $a,b\,$ such that $\,p\mid ab,\ p\nmid a,\ p\nmid b\,$ so $\,f= px+a,\,g = px+b\,$ are primitive but $\,p\mid fg\,$ so $\,fg\,$ is not primitive, so Gauss's Lemma fails. See here for more.