TITLE: Can a complex number be prime?
QUESTION [38 upvotes]: I've been pondering over this question since a very long time. 
If a complex number can be prime then which parts of the complex number needs to be prime for the whole complex number to be prime.

REPLY [64 votes]: The notion of being "prime" is only meaningful relative to a base ring.
For instance, in the integers $\mathbb{Z}$ the number 5 is prime, whereas in the Gaussian integers $\mathbb{Z}[i]$ we have
$$5 = (2 + i)(2 - i) = 2^2 - i^2 = 4 - (-1) = 5$$
and in the ring $\mathbb{Z}[\sqrt{5}]$ we have
$$5 = (\sqrt{5})^2$$
so over these rings 5 is not a prime number.
The definition of prime you're probably familiar with -- a number is prime if it is divisible only by itself and one -- doesn't even really work over the integers: for instance, 5 is divisible not only by 1 and 5, but also by -1 and -5.  So we need to formulate the definition of a prime differently, while still preserving the basic idea, to make sense of it in an arbitary ring.
Notice the following difference between primes and composites: since 5 is prime, if we have two numbers $a$ and $b$ such that $ab$ is a multiple of 5, then obviously one of $a$ or $b$ has to be a multiple of 5 just by unique factorization.  On the other hand, if $ab$ is a multiple of 15, it may be the case that neither $a$ nor $b$ is a multiple of 15, because we might instead have $a$ a multiple of 3 but not 5 and $b$ a multiple of 5 and not 3. †
This gives us our definition of "prime" for a general ring: a ring element is prime if it is neither zero nor a unit, and moreover has the property that whenever it divides a product it must divide at least one of the factors.
There are a great many rings contained in the complex numbers, and in many of these rings there are non-real complex numbers that are primes in that ring.  However, given any number that's prime in a given ring, there's a larger ring in which it's not prime, just as we saw above that 5 is prime over the integers, but not over the Gaussian integers $\mathbb{Z}[i]$ or over $\mathbb{Z}[\sqrt{5}]$.
In particular, since $\mathbb{C}$ is a field, every nonzero element is a unit, so nothing is prime over the complex numbers.  (Similarly, nothing is prime over the real numbers, or the rational numbers.)  However, I reiterate that many complex numbers are prime over smaller rings: for instance, it turns out that $2 + i$ is prime over $\mathbb{Z}[i]$.

† A slightly more straightforward generalization of the definition you're used to would be to look at nonzero, nonunit elements $r$ for which we only have $r = s t$ when either $s$ or $t$ is a unit.  This actually gives a weaker notion called "irreducibility."  In Unique Factorization Domains the two notions are the same (which explains why they're the same for the integers), but in rings like $\mathbb{Z}[\sqrt{-5}]$ where we do not have unique factorization you can have situations like
$$3 \cdot 3 = 9 = (2 + \sqrt{-5})(2 - \sqrt{-5})$$
Here each of $3$, $2 + \sqrt{-5}$, and $2 - \sqrt{-5}$ is irreducible, with none dividing any of the others.  We've decided that being "prime" is about unique prime factorization, so we chose a definition of "prime" under which each of the above is "irreducible" but none is "prime."

Note: several answers (including this one) have brought up the Gaussian integers specifically.  They're indeed an example of a subring of the complex numbers containing non-real complex numbers, but just to be clear they're in no way "the" natural example here -- they're on the same footing as all the others.