Why study schemes?

Edit: Edited to better organize the trichotomy noted in the comments of Qiaochu Yuan and Zhen Lin.

There are three distinct aspects of schemes that each have their own purpose:

(1) Affine schemes generalizing affine varieties by allowing nilpotent elements in the coordinate ring. When you look at families of affine varieties, sometimes the limiting space is only a scheme and not a variety. For example, consider the affine variety given by the equation $z^2 = txy$. This is a well-defined affine variety that is presented as a subvariety of $\mathbb{A}^4$. We could also view it as a family of affine subvarieties of $\mathbb{A}^3$ parameterized by $t$. However, this is only valid for $t \neq 0$. When $t = 0$, the equation becomes $z^2 = 0$. You could do two things to resolve this: (a) Eliminate the nilpotents and say that variety is $z = 0$ when $t = 0$. With this approach, you now have to check for nilpotents every time you degenerate a variety, and then remove them. And now there are very few theorems you can prove about two different varieties that occur in a family. (b) Accept that nilpotents are inevitable when trying to understand families of varieties, and allow them in your geometric theory. At the cost of additional abstraction and more technical baggage necessary, you are able to prove much more powerful theorems relating varieties in a family (for example, the constancy of the Hilbert polynomial in a flat family of subvarieties of projective space -- if you don't know what that means yet, that's okay, but it's a very important result).

(2) The second reason, anticipated somewhat by Kronecker, is that replacing the coordinate ring of an affine algebraic variety with an arbitrary commutative ring yields a striking connection between algebaric goemetry and algebraic number theory. In particular, many properties of $\text{Spec } \mathcal{O}_K$ relate to classical number theory invariants of $\mathcal{O}_K$, the ring of integers of an algebraic number field. For example, ramification in number fields can be interpreted as ramification of the associated geoemtric map between their spectra. You can also use this approach to study algebraic varieties over fields that are not algebraically closed.

(3) Once you accept affine schemes, a general scheme is obtained as a certain ringed space that is locally isomorphic to an affine scheme. This idea goes back to Weil, and it was introduced in algebraic geometry for the same reason that general manifolds were introduced to replace the study of embedded manifolds in Euclidean space. This allows gluing constructions, without having to check whether the resulting space is embedded in an affine or projective space. Of course, the main interest is still in studying affine and projective varieties, but the generality of schemes allows one to make many more constructions to study them.

There are a couple of really good sources to turn to learn more about this:

(1) Dieudonne's classical book, History of Algebraic Geometry

(2) Ravi Vakil's book in progress, Foundations of Algebraic Geometry