If you want an example which is an integral domain, consider the ring $\mathbf{Z}[i \sqrt3]$ which consists of complex numbers of the form
$$
z = a + b i \sqrt{3}
,\qquad
a,b \in \mathbf{Z}
.
$$
Then
$$
4 = 2 \cdot 2
$$
and
$$
4 = (1+i \sqrt3)(1-i \sqrt3)
$$
are two essentially different factorizations of $4$ into irreducible elements.
That the numbers $z=2$ and $z=1 \pm i \sqrt3$ are irreducible in this ring can be seen by contemplating the $\mathbf{Z}$-valued function $N(z)=|z|^2=a^2+3b^2$ which has the multiplicative property $N(z_1 z_2)=N(z_1)N(z_2)$. Since $N(z)=4$ in both cases, and $N=1$ only for the invertible elements $\pm 1$, a nontrivial factorization $z=w_1 w_2$ would have to have $N(w_1)=N(w_2)=2$, but the ring contains no elements with $N=2$.
On the other hands, those numbers cannot be prime in this ring,
since a factorization of a ring element into primes is always essentially unique (i.e., unique up to reordering and multiplication by invertible elements), and we saw two different factorizations of $4$ above.