Some terms:
- A domain is factorization if every element can be factored into irreducible elements.
- And is unique factorization if the factorizations are unique up to associates and ordering.
If $F$ is a field then $F[x]$ is unique factorization. The standard proof shows that PID $\Rightarrow$ UFD and also shows that $F[x]$ has Euclidean division and hence is a PID (principal ideal domain). You can look this up in standard texts or online notes on abstract algebra and number theory.
There are subrings of $\Bbb C$ that are not factorization, let alone unique factorization. For example if we let $T$ be any transcendental element, if $P:=\{T^r:r\in\Bbb Q,r\ge0\}$, in the ring $R[P]$ the element $T$ cannot be factored into irreducibles (note $T=(\sqrt[n]{T})^n$ for all $n\ge1$). If a ring is not factorization then the formal polynomial ring over it is not factorization. This relies on the fact that "irreducible polynomials" are defined to be polynomials that are irreducible elements, and that if something is irreducible in a domain then it remains irreducible in the polynomial ring.
If we loosen our notion of "associate" to nonunits too (i.e. nonunit nonzero multiples of an element are also associate) our conclusions change. Let's call the corresponding notions "loose factorization" and "loose unique factorization."
Suppose $R\subseteq\Bbb C$ is a subring. Let $F={\rm Frac}(R)$ be the fraction field. Suppose a polynomial of $R[x]$ has two factorizations. These factorizations also exist in $F[x]$, and as $F$ is a field must be associate to each other up to units of $F$ and ordering, which means the two factorizations are equivalent within $R[x]$ by multiplying each factorization by an appropriate element of $R$. (This follows from the fact that all fractions in $F$ can be written as $a/b$ with $a,b\in R$.) Therefore, $R[x]$ has the property of being loose unique factorization.
The same reasoning applies to any domain $R$. For rings with zero divisors I am not sure if the polynomial ring is loose factorization. (One may also change the definition of "associates" again to mean up to nonunit non-zero-divisor multiples.)
Converting my comment into an answer, as requested. I'm assuming you are familiar wih the theory of finitely generated abelian groups.
I. First set of examples.
Lemma. Let $R$ be an integral domain which is finitely generated as an additive abelian group. Then for all $a\in R, a\neq 0$, the quotient ring $R/(a)$ is finite.
Proof. $R$ is in fact a free abelian group: it is finitely generated and has no $\mathbb{Z}$-torsion since $R$ is an integral domain. If $(e_1,\ldots,e_n)$ is a $\mathbb{Z}$-basis of $R$, $(ae_1,\ldots,ae_n)$ is a $\mathbb{Z}$-basis of $aR$ (again because $R$ is an integral somain). Hence, $R/aR$ is the quotient of two free abelian groups of same rank, hence is finite.
Examples. Take a PID $R$ which is finitely generated as an abelian group. Take $\pi$ be a prime element. Then $\pi R$ is maximal, since $R$ is a PID. Hence $R/\pi R$ is a field, which is finite by the previous lemma.
If $q$ is the number of elements of $R/\pi R$, set $P=\dfrac{1}{\pi}(X^q-X)$. Then $P(R)\subset R$.
Concrete examples of such $R$: any ring of integers of a number field which is a PID, such as $\mathbb{Z}[i],\mathbb{Z}[j],\mathbb{Z}[i\sqrt{2}],\mathbb{Z}[\sqrt{2}],\mathbb{Z}[\dfrac{-1+i\sqrt{19}}{2}],\mathbb{Z}[\zeta_p], p<23,\mathbb{Z}[\sqrt[3]{2}]$...
II. Second set of examples. Take $R=\mathbb{F}_q[T]$, take $\pi\in R$ an irreducible polynomial of degree $d$. Then $R/(\pi)$ is a finite field with $q^d$ elements. Set $P=\dfrac{1}{\pi}(X^{q^d}-X)$.
Best Answer
This can even be done with one variable: $$ 2\cdot \left(\frac{x(x+1)}{2}\right)=\big(x\big)\cdot\big(x+1\big). $$ If you prefer to avoid irreducibles that become units in $\mathbb{Q}$: $$ \left(\frac{x(x+1)}{2}\right)\cdot\left(\frac{(x+2)(x+3)}{2}\right) = \left(\frac{x(x+3)}{2}\right)\cdot\left(\frac{(x+1)(x+2)}{2}\right). $$