Affine varieties are special cases of more general objects called algebraic varieties. A special case is that of a projective variety. This is a set in projective space whose intersection with any affine subspace is an affine variety. Varieties are given an important topology called the Zariski topology in which the closed subsets are the subvarieties.
Algebraic geometry was developed largely by the Italian geometers in the early part of the 20-th century. Their work was deep but not on a sufficiently rigorous basis. Commutative algebra was developed by Hilbert, Emmy Noether and others, also in the 20-th century, with the geometric applications in mind. In the 1930's and 1940's Andre Weil realized that putting algebraic geometry on a rigorous basis was needed and he gave such a theory. In the 1950's and 1960's Serre and particularly Grothendieck recast the foundations making use of the theory of sheaves. In Grothendieck's formulation the study of algebraic varieties has been replaced by that of more abstract objects called schemes.