More specifically:
Not all ideals are principal. For example, consider the commutative ring C[x,y] of all polynomials in two variables x and y, with complex coefficients. The ideal (x,y) generated by x and y, which consists of all the polynomials in C[x,y] that have zero for the constant term, is not principal. To see this, suppose that p were a generator for (x,y); then x and y would both be divisible by p, which is impossible unless p is a nonzero constant. But zero is the only constant in (x,y), so we have a contradiction.
A ring in which every ideal is principal is called principal, or a principal ideal ring. A principal ideal domain (PID) is an integral domain that is principal. Any PID must be a unique factorization domain; the normal proof of unique factorization in the integers (the so-called fundamental theorem of arithmetic) holds in any PID.
Also, any Euclidean domain is a PID; the algorithm used to calculate greatest common divisors may be used to find a generator of any ideal. More genarally, any two principal ideals in a commutative ring have a greatest common divisor in the sense of ideal multiplication. In principal ideal domains, this allows us to calculate greatest common divisors of elements of the ring, up to multiplication by a unit; we define gcd(a,b) to be any generator of the ideal (a,b).
For a Dedekind domain R, we may also ask, given a non-principal ideal I of R, whether there is some extension S of R such that the ideal of S generated by I is principal (said more loosely, I becomes principal in S). This question arose in connection with the study of rings of algebraic integers (which are examples of Dedekind domains) in number theory, and led to the development of class field theory by Teiji Takagi, Emil Artin, David Hilbert, and many others. It turns out that every integer ring R (i.e. the ring of algebraic integers of some number field) is contained in a larger integer ring S which has the property that every ideal of R becomes a principal ideal of S.
The fraction field of S is then called the Hilbert class field of R; it is the maximal unramified abelian extension (that is, Galois extension whose Galois group is abelian) of the fraction field of R, and it is uniquely determined by R.