The usual proof for unique factorization in $\mathbb{Z}$ proceeds via the concept of GCD (greatest common divisor) of two integers leading to the fundamental property of primes in $\mathbb{Z}$:
Theorem: If $p$ is prime and $a, b \in \mathbb{Z}$ such that $p\mid ab$ then either $p\mid a$ or $p\mid b$.
And this is the result which guarantees uniqueness of factorization. Note that the same procedure does not apply in $\mathbb{Z}[x]$ as we don't have a concept of GCD here. Thus for example we can't say that $2, x$ have GCD $1$ because we can't find polynomials $p(x), q(x) \in \mathbb{Z}[x]$ such that $$1 = 2p(x) + xq(x)$$ (contradiction arises when we put $x = 0$ in above equation).
The problem is eliminated by considering polynomials in $\mathbb{Q}[x]$ and then we have the GCD available here so that $\mathbb{Q}[x]$ is a unique factorization domain. Next we use the fact that $\mathbb{Z}[x]\subset\mathbb{Q}[x]$ to factorize elements of $\mathbb{Z}[x]$ as product of polynomials in $\mathbb{Q}[x]$ and then use Gauss lemma to prove that the factorization can also be done using polynomials in $\mathbb{Z}[x]$ only.
Thus it appears that existence of GCD is not necessary to guarantee existence of unique factorization. Does that mean we can prove unique factorization in $\mathbb{Z}$ via some other means rather than the approach I outlined in the beginning?
Also I would like to know if the property of prime numbers (mentioned in theorem at the beginning) is always a consequence of the existence of GCD in a more generally setting of integral domains?
Update: From the comments and in particular the wiki link given by Hand Lundmark it is clear that the ideas of the usual ring of integers have been generalized in many ways to give rise to the famous chain of class inclusions (see wiki link on GCD Domains) and this question is perhaps a very naive attempt to understand that all (or some of) those inclusions are proper.
Further Update: I was a bit hesitant about asking question related to a seemingly trivial matter (namely unique factorization in integers and polynomials with integer coefficients), but the way it has been received here is so much more than what I expected. MSE never ceases to amaze me (and perhaps other users too)! Thanks to all those who answered/commented/chatted. I have now got a lot of food for thought (and study).
;-)
The ring $k[x_1,x_2,\dots,x_n]$ ($k$ a field) has unique factorization, which allows us to talk about irreducible (algebraic) varieties in $n$-space. On the other hand, it is Bézout only if $n=1$ and you can think of some good geometric reasons why it is not Bézout for $n=2$ (take two irreducible conics). – egreg Apr 15 '17 at 09:49