This is a central example of a phenomenon the nLab calls too simple to be simple. Some other related examples: the empty graph and empty topological space are not connected, the zero module over a ring is not simple. The nLab has other examples. Typically examples here are confusing because people give definitions that don't correctly specialize to "degenerate" cases.
Sticking to just the case of prime numbers to start with, here is one way to define a prime number that transparently excludes $1$: associated to any positive integer $n$ we can consider its poset of divisors $\{ d : d \mid n \}$. If $n$ has unique factorization $\prod p_i^{n_i}$ then this poset is correspondingly a product $\prod \{ 0 < \dots < n_i \}$ of finite chains, one chain for each prime divisor of $n$.
Definition: A positive integer $n$ is prime iff its poset of divisors is a chain $\{ 1 \mid n \}$ of length exactly $2$.
So $1$ isn't prime because its poset of divisors is a chain of length $1$. Chains of length $1$ and chains of length $2$ behave quite differently!
Now let's discuss prime ideals. Of course there's a historical motivation here: we want ideals in a Dedekind domain, such as the ring of integers $\mathcal{O}_K$ of a number field $K$, to have a unique factorization into prime ideals, and this requires that the unit ideal not be considered prime. I would guess that this is the historical motivation, since this was the historical motivation behind the definition of ideals in the first place (Kummer called them "ideal numbers").
But from a modern perspective this is a pretty specific class of rings; also, since nonzero prime ideals of a Dedekind domain are maximal, thinking only about Dedekind domains doesn't really distinguish between prime and maximal ideals, either. We ought to be able to say something more general about prime ideals in arbitrary commutative rings. My preferred definition of a prime ideal is that an ideal $P$ of a commutative ring $R$ is prime iff $R/P$ is an integral domain. So the question of why prime ideals have to be proper is equivalent to:
Why must we exclude the zero ring $0 = \{ 0 \}$ from the definition of an integral domain?
There are several different answers you could give to this, off the top of my head.
One way to define integral domains is that they are exactly the subrings of fields. So this further reduces the question to: why must we exclude the zero ring from the definition of a field? There are again several ways to respond to this, but for example, one way to define a field is that a field $F$ is a commutative ring such that $F \setminus \{ 0 \}$ is a group under multiplication. This naturally forces $1 \neq 0$.
It's also worth discussing maximal ideals here, since one way to define maximal ideals is that an ideal $m$ is maximal iff the quotient $R/m$ is a field. Here is a different way to define fields which directly generalizes the definition I gave above of prime numbers: a commutative ring $R$ is a field iff its poset of ideals is a chain $\{ 0 \subsetneq 1 \}$ of length exactly $2$. So this is also a way to explain why maximal ideals must be proper.
A commutative ring $R$ being an integral domain roughly corresponds to its spectrum $\text{Spec } R$ being irreducible (strictly speaking we need $R$ to be reduced for this to be an if-and-only-if). Irreducibility is a strong connectedness condition, and so disallowing the zero ring from being an integral domain (equivalently, forcing the spectrum of the zero ring to be empty) is closely related to the idea that the empty topological space is not connected. In turn, one way to justify the disconnectedness of the empty topological space is that a connected topological space should be a topological space that has exactly $1$ connected component, while the empty space has $0$ connected components.
Some definitions in algebra make more sense when you try to phrase them in terms of $n$-ary operations rather than just binary operations. An $n$-ary way to describe an integral domain is that a commutative ring $R$ is an integral domain if $R \setminus \{ 0 \}$ is closed under $n$-ary multiplication for all $n$. Setting $n = 0$ gives that $R \setminus \{ 0 \}$ must be closed under empty products, and the empty product is $1$. So this forces $1 \neq 0$. We see from this line of reasoning that the usual definition of an integral domain, which considers $n = 2$ only, imposes this condition for all values of $n$ except $0$, but we get a more uniform description that correctly excludes the zero ring by writing down a condition for all $n$ simultaneously.
This last explanation is new to me but I think I like it the best. It's closely related to the idea that empty products explain why rings should have multiplicative identities; this is not an extra axiom but a special case of $n$-ary associativity, as explained e.g. by Bjorn Poonen in Why all rings should have a $1$.