Factorization
Let $R$ be a ring.
An element $x\in R$ is irreducible if $x$ is not a unit and for all $y, z\in R$, $x = y z$ implies $y$ or $z$ is a unit.
An element $x \in R$ is prime if $x \ne 0$, $x$ is not a unit and for all $y,z\in R$, we have $x  yz \implies xy \text { or } xz$. Note $x$ is prime if and only if $x R$ is a prime ideal.
In an integral domain, all primes are irreducbile. The converse is not always true. For example, take $R =\mathbb{Z}[\sqrt{5}]$. Then by using the norm, it can be deduced that the units of $R$ are $\pm 1$. We have $6 = 2\cdot 3 = (1+\sqrt{5})(1\sqrt{5})$, where all the factors are irreducible but not prime.
An integral domain $R$ is a unique factorization domain (UFD) if every nonzero nonunit of $R$ can be expressed as a product of irreducibles and furthermore the factorization is unique up to order and associates. In a UFD, all irreducibles are prime.
Example: $\mathbb{Z}$ is a UFD. All fields are trivially UFD’s.
Gauss' Theorem: If $R$ is a UFD then the polynomial ring $R[x]$ is a UFD.
Proof: Consult an abstract algebra textbook.
Example

Let $R = F[x_1,...,x_n]$ where $F$ is a field. By Gauss' Theorem $R$ is a UFD. If $p \in R$ is any irreducible polynomial over $F$ then it is also prime, and the principal ideal $p R$ is a prime ideal of $R$.

Let $R = \mathbb{Z}$ or $R = F[x]$ for some field $F$. By using the Euclidean algorithm, it can be seen that every ideal of $R$ is principal. (In $\mathbb{Z}$, the nonzero prime ideals are generated by a prime, while in $F[x]$, the nonzero prime ideals are generated by irreducible polynomials.) In these rings, it turns out that all nonzero prime ideals are also maximal, for reasons we shall see below.
A principal ideal domain (PID) is an integral domain in which all ideals are principal.
Proposition: Let $R$ be a PID. Then every nonzero prime ideal is maximal.
Proof: Let $I = x R$ be some nonzero prime ideal. Suppose $I$ is strictly contained in some ideal $y R$ of $R$. Then $x = y z$ for some $z\in R$. Since $I$ is prime, we must have $y \in I$ or $z \in I$. The former would imply $y R$ is contained in $I$, a contradiction. So we must have $z \in I$. In other words, $z = x t$ for some $t \in R$, hence $x = x y t $. implying that $y t = 1$. Thus $y$ is a unit so $y R = R$.
Example: Going back to the example $R = F[x_1,...,x_n]$ for some field $F$, set $M = \{p\in Rp(0) = 0\}$ (the set of polynomials with zero constant term). We have $A/M \cong F$ thus $M$ is maximal. Now if $n \gt 1$, $M$ is not principal, because any set of elements that generates $M$ must contain at least $n$ elements.