Let $X$ be obtained from $S^2 \times S^2$ by attaching a $3$-cell to the second $S^2$ factor by a map $S^2 \to S^2$ of degree $2$. Then from cellular cohomology it follows that $H^*(X;\Bbb Z)$ consists of $\Bbb Z$'s in dimensions 0,2, and 4, and a $\Bbb Z_2$ in dimension 3. Hatcher then says cup products (in $H^*(X;\Bbb Z)$) of positive-dimensional classes are zero because the only nontrivial product is the square of the 2-dimensional class, but this is zero as one sees by restricting to the subcomplex $S^2 \times S^2$.
I see that the only nontrivial product is the square of the $2$-dimensional class, but I can't see why we can conclude that it is zero by restricting to $S^2 \times S^2$. I know that $S^2 \times S^2 $ has cohomology $\Bbb Z[x_1,x_2]/(x_1^2, x_2^2)$ with $|x_1|=2=|x_2|$, so a square of any 2-dimensional class in $H^*(S^2\times S^2;\Bbb Z)$ is zero. But how can we conclude that the square of the $2$-dimensional class of $H^*(X,\Bbb Z)$ is zero?
Firstly it is not true that every class in $H^2(S^2\times S^2)$ squares to zero. For instance, in your notation, the class $x_1+x_2$ satisfies
$$(x_1+x_2)^2=x_1^2+x_1x_2+x_2x_1+x_2^2=x_1x_2+(-1)^{2\cdot 2}x_1x_2=2x_1x_2$$
and this is nonzero in $H^4(S^2\times S^2)\cong\mathbb{Z}$. Thus we have to work a little bit to check the statement in any case.
To begin consider the long exact sequence
$$\dots\rightarrow H^*(X,S^2\times S^2)\rightarrow H^*X\xrightarrow{j^*} H^*(S^2\times S^2)\rightarrow \dots$$
where $j:S^2\times S^2\hookrightarrow X$ is the inclusion. We have
$$H^*(X,S^2\times S^2)\cong\widetilde H^*(X/S^2\times S^2)\cong \widetilde H^*S^3$$
so the long exact sequence breaks up into a piece
$$0\rightarrow H^2X\xrightarrow{j^*} H^2(S^2\times S^2)\xrightarrow{\Delta} H^3S^3\rightarrow H^3X\rightarrow 0$$
and an isomorphism
$$0\rightarrow H^4X\xrightarrow{j^*} H^4(S^2\times S^2)\rightarrow 0.$$
It follows that $j^*$ is injective in dimensions $2$ and $4$, so if $u\in H^2X$, then $u^2=0$ if and only if $j^*(u^2)=(j^*u)^2=0$.
Now, where we have to work is to check what $j^*$ does in degree $2$. We know that in forming $X$ we have attached the $3$-cell to $S^2\times S^2$ along the composite map
$$\varphi:S^2\xrightarrow{2}S^2\xrightarrow{in_2}S^2\times S^2$$
We also know that the generators $x_1,x_2\in H^2(S^2\times S^2)$ are given by cohomology cross products. In particular, if $s\in H^2S^2$ is a generator then we can write
$$x_i=pr_i^*s,\qquad i=1,2,$$
where $pr_i:S^2\times S^2\rightarrow S^2$ is the projection onto the i$^{th}$ factor.
Knowing this, we can use a suspension isomorphism to identify $H^3S^3\cong H^2S^2$, and, with a bit of agility, calculate the action of the boundary map $\Delta$ above as
$$\Delta(x_1)=0,\qquad \Delta(x_2)=2\cdot s$$
where $s\in H^2S^2\cong H^3S^3$ is (the suspension of) the generator introduced above.
The point is that we get from exactness that $H^2X\cong\mathbb{Z}$, generated by a class $u$ satisfying
$$j^*u=x_1.$$
Now it is clear that
$$j^*(u^2)=(j^*u)^2=x_1^2=0$$
and hence that $u^2=0$.