History of the terms "prime" and "irreducible" in Ring Theory.

I'm not an expert in the history of ring theory but this is, I think, pretty close to a correct answer:

You are right that the notion of "prime integer" predates the more general notions of "prime element" and "irreducible element" in an arbitrary ring. In fact, prime numbers go back to ancient Greece! But there is a missing link in the evolution of that original notion into the (two distinct) modern notions: namely, the notion of a prime ideal.

Ideals were regarded as a kind of "generalized number"; in fact, the original terminology was "ideal number", only later shortened to "ideal". One ideal $I$ was said to divide another ideal $J$ if and only if $J \subset I$. A prime ideal is then defined, in precise analogy with the "classical" definition of prime numbers (i.e. as indecomposables) to be an ideal that is not divisible by any ideals other than itself and the entire ring.

Once "prime ideal" was defined, the next development was to say that an element was prime if it generated a prime ideal. It is a fairly straightforward exercise to show that this translates directly to the modern definition of prime element. It is also fairly easy to show that (as long as there are no zero-divisors in the ring) every prime element is indecomposable in the classic sense. So everything fits together quite nicely.

It is only at this point that somebody starts looking at rings like $\mathbb{Z}[\sqrt{-5}]$, which are not unique factorization domains, and realizes that those rings can contain elements that are indecomposable in the classic sense, but do not generate prime ideals. Whoah! So we need a name for those types of elements. "Prime" is already taken, so they get called "irreducible".

So there you have it. The elements that we now call "irreducible elements", despite the fact that they have the property that we usually associate with "prime numbers", were not called "prime elements" because that word was already in use for elements that generate "prime ideals", which are defined in direct analogy with how we "usually" define prime numbers.