If you take the affine variety with its Zariski topology, it is (among other things) a topological space $V$.
Now given a topological space $V$, we can construct a new topological space
$X$ whose points are (by definition) the irreducible closed subsets of $V$,
and whose open sets are in bijection with the open sets of $V$ by mapping an open set $U$ in the latter to the set of irreducible subsets of $V$ which have non-empty intersection with $U$.
There is a map from $V$ to $X$ which sends a point in $V$ to its closure,
and by construction the topology on $V$ is obtained by pull-back from the topology on $X$ (i.e. the open sets in $V$ are precisely the preimages of the open sets in $X$).
So: two points of $V$ map to the same point of $X$ if and only they have
the same closure, and hence $V \to X$ is injective
iff $V$ is $T_0$ (i.e. two points with the same closure coincide); in this case $V$ is a topological subspace of $X$.
The map $V\to X$ is a homeomorphism if and only if every irreducible subset of $V$ has a unique generic point, i.e. if and only if $V$ is sober.
Affine schemes are sober, so this construction does nothing in the case of an affine scheme.
But affine varieties are not sober (unless they are zero-dimensional), and the construction $V\mapsto X$ in this case gives rise to the corresponding affine scheme. Given $X$, we can recover $V$ as the subset of closed points in $X$.
(If we want to be more sophisticated and think about structure sheaves, we can do that too: the structure sheaf on the scheme $X$ is the pushforward of the structure sheaf on $V$, and the structure sheaf on $V$ is the restriction of the structure sheaf on $X$.)
So there is a completely functorial, purely topological mechanism for moving from the affine variety $V$ to the affine scheme $X$, and back again, and so the two objects carry identical information. But sometimes it is convenient to work explicitly on $X$, so that all the generic points are available; it often simplifies sheaf-theoretic arguments (but any argument using the generic points can be rephrased in a way that works entirely on $V$, via the above discussion). And of course the affine scheme $X$ sits in a wider world of all schemes, not all of which correspond to affine varieties, or to varieties at all, and this is
often useful too.
Best Answer
Question: "The question is what's the relation between coordinate ring A and A1,A2 ?"
Answer: @yi li - If an affine scheme $X:=Spec(A)$ has an open cover $D(f_1),D(f_2)$ of two basic open sets you may write down the Cech-complex corresponding to this covering. Take a global section $s\in A$ and restrict it to $U_i:=D(f_i)$ to get $s_i$. Restricting further to $V:=U_i \cap U_j$ you get $(s_i)_V=s_V=(s_j)_V$. Given two sections $s_i \in A_i:=A_{f_i}$ agreeing on $V$ there is by the sheaf property an element $s\in A$ with $s_{U_i}=s_i$. Hence $A$ is isomorphic to the set of pairs $(s_1,s_2) \in A_1\oplus A_2$ with $(s_1)_V=(s_2)_V$.