One theorem you might have come across is the set of morphisms $X \to Y$, for $X$ and $Y$ affine varieties, is in canonical bijection with the set of homomorphisms $A(Y) \to A(X)$ of their coordinate rings. In particular, up to isomorphism, there is a unique affine variety with a given coordinate ring (so long as that ring is actually of the right form to appear as a coordinate ring, that is, a finitely-generated, reduced algebra over the base field $k$). More generally, if $Y$ is affine but $X$ may not be, the morphisms $X \to Y$ are given by the homomorphisms of rings from $A(Y)$ to the ring of global regular functions on $X$.
The reason that this is is that we've defined affine varieties to have just enough structure to be controlled by their coordinate rings. The Zariski topology and the definition of a morphism are just ways of formalizing this. Now, not all varieties are affine, but they're all locally affine, so again, a morphism of varieties $X \to Y$ can be thought of as a bunch of ring homomorphisms from affine coordinate rings of affine subsets of $Y$ that agree on the necessary intersections. An affine variety can be thought of as telling you (1) a geometric object and (2) what polynomial functions on that geometric object look like.
Under this point of view, the reason that the affine line and a cuspidal curve aren't isomorphic is that their coordinate rings aren't isomorphic. The coordinate ring of the line is just $k[t]$, but, for example, the coordinate ring $k[x,y]/(y^2 - x^3) \cong k[t^2,t^3]$ of the cuspidal curve $y^2 - x^3$ in $\mathbb{A}^2$ differs by not being integrally closed. That is, there is a rational function (here $y/x$) that behaves like a regular function on the curve, but doesn't make sense as a regular function when extended to the plane. The non-isomorphism between the two coordinate rings precisely tells you about the cusp and the various problems it causes.
At this point, there are two motivations. One is that a lot of geometric constructions have nice, algebraic definitions. For instance, the actions of passing to a closed subvariety or omitting a closed subvariety, which in terms of the Zariski topology are just taking open and closed subsets, correspond respectively to taking a quotient or localization of a ring. Even this simple example shows why the algebraic structure is nice to have: while it's obvious what a closed subvariety should look like over $\mathbb{C}$, what its codimension should be, et cetera, you lose the nice picture as soon as you move to a non-topological field. If you care about solving polynomials over fields other than $\mathbb{C}$, you need a theory that mimics the geometric features of $\mathbb{C}$ (and thus allows you to talk about dimension, tangent vectors, smoothness, and so on) without using its analytic topology.
A slightly more complicated example is flatness. A ring homomorphism $R \to S$ is flat if, whenever $M \to N$ is an injection of $R$-modules, $S \otimes_R M \to S \otimes_R N$ is an injection of $S$-modules. Serre found that this slightly arcane algebraic condition is actually the best way to talk about deformations of varieties. Namely, given a morphism $f:X \to Y$ of varieties, you can think of the various fibers $f^{-1}(y)$ for $y \in Y$ to be deformations of each other; if the morphism locally corresponds to a flat ring homomorphism, then these deformations are actually nicely behaved (they'll all be the same dimension, and so on).
If you're interested in solving polynomial equations over fields, this should hopefully be enough motivation. This is a fascinating subject on its own, of course. For example, Serre's GAGA established deep relations between the algebraic geometry of varieties over $\mathbb{C}$ and their analytic geometry as manifolds; statements like Fermat's Last Theorem are naturally statements about solutions to polynomials over fields; and I hear that solutions to polynomials over finite fields are important to modern-day cryptography, among other things.
If this isn't enough, here's the second piece of motivation. Even if you don't care about varieties, there are a lot of reasons to care about rings. Varieties can be thought of as nicer versions of rings, ones that we can patch together and use geometric intuition on, and some statements purely about rings can be cleanly proved in the language of varieties. The one caveat is that only certain rings appear as affine coordinate rings of affine varieties. For example, if you're interested in number theory or diophantine equations, you might want to study rings that aren't algebras over any field; other areas of math naturally give rise to non-noetherian rings, which then don't arise as finitely generated algebras over fields. A major program of Grothendieck in the 1960's, which has greatly influenced modern-day algebraic geometry, was to generalize varieties to more general objects, called schemes, that do for arbitrary rings what varieties do for finitely generated, reduced algebras over a field. Now, a scheme is much harder to picture than a variety, but it can be tremendously helpful in terms of applying some sort of geometric intuition to arbitrary rings.
So, in summary, varieties have rings attached to them given by the polynomials 'defined on' that variety, and a morphism of varieties is supposed to pull polynomials on its codomain back to polynomials on its domain (which Michael Joyce's answer explained quite well). The structure of a variety is meant to encode precisely this information, and thus to allow us to use our geometric intuition over fields where analytic reasoning is no longer possible. More generally, defining schemes allows us to use this geometric intuition to understand arbitrary rings.
Algebraic geometry is an old, wide, and fascinating field, and I guarantee you that if you continue to study it, you will find some key idea that puts all this into context and makes everything make sense for you personally. A few good sources to begin that journey are Harris's Algebraic Geometry: A First Course (for the variety-centric point of view), Hartshorne's Algebraic Geometry and Vakil's excellent online notes (if you're interested in schemes), and Eisenbud and Harris's The Geometry of Schemes (only after you've gained a bit of experience -- it attempts to provide motivation and geometric intuition for many ideas about schemes). Best of luck with it!