They're implicitly using that (x) = (ux) for all units u in R.

Have (p) contained in an ideal I implies (via PID) that I = (m) for some m.

Now p in (m), so there exists r such that p = rm.

By p irreducible, p = rm implies that either r or m is a unit.

If r is a unit, then from p = rm, have (p) = (rm) = (m) = I. Thus (p) = I.

If m is a unit, then I = (m) = (m*m) = (1) = R. Thus I = R. (Where m* is the multiplicative inverse of m, which is itself a unit.)

Thus (p) is a maximal ideal, because the only ideals containing (p) are (p) itself and R.

Maximal ideals are prime, thus (p) is a prime ideal.

Thus p is a prime element.