This relationship is a very beautiful one.
Imagine a Riemann surface. There are different ways to introduce it, but since you gave kind of a reference point, let's just define it as a projective variety in the complex projective plane. Now the people call it a surface because it looks two-dimensional from a real point of view. You can also draw a picture of Riemann surface covering a sphere by projection onto a coordinate.
Now what could be an object of study of algebraic geometry? Why, certainly it should be some geometric object defined by algebraic means. Among the different ways to start learning algebraic geometry let's say we selected the abstract definition of an algebraic curve. To recap, this a a geometry locally defined by algebraic equations in some space so that the resulting manifold is one-dimensional.
These algebraic curves can be studied purely abstractly. You can, e.g., define algebraic forms on these, and prove various theorems relating to their geometry.
But the beautiful fact is that those are two sides of the same medal. That's right:
Every Riemann surface is a complex algebraic curve and every compact complex algebraic curve can be embedded into a projective plane and drawn as the Riemann surface.
There are lots of gems in this short statement. For example, as I said there is a way to count the algebraic forms in terms of inner geometry of algebraic curve. This gives some number, which could be 0, 1, 2, etc. On the other hand, if you draw a Riemann surface, you notice that it can be studied in topology and then it has the invariant called the number of handles which could also be 0 (sphere), 1 (torus), 2, etc. It turns out this is exactly the same thing though defined in a completely different way by a completely different branch of mathematics.
The whole algebraic geometry is, so to say, our attempt to make ourselves comfortable about this amazing connection between things we calculate (algebra) and things we draw (geometry).