Solution (source code)

= Solution

Because $p:X_1\times X_2\to X$ is an isomorphism and $X$ is connected, each $X_i$ is connected. They are complete because they are closed in the complete variety $X$. Let
$$
q_i=\operatorname{pr}_i\circ p^{-1}:X\longrightarrow X_i
$$
be the two component morphisms.

For $x,x'\in X_1$, the morphism
$$
(x,x')\longmapsto q_2(x+x')
$$
from $X_1\times X_1$ to $X_2$ is constantly $e$ on either coordinate axis. Rigidity therefore makes it constantly $e$, so $X_1$ is closed under addition. The same argument applies to $X_2$. If $-x=u+v$ is the unique decomposition with $u\in X_1$ and $v\in X_2$, then $e=(x+u)+v$; uniqueness of the decomposition of $e$ gives $v=e$ and $u=-x$. Thus each $X_i$ is also closed under inversion.

The restrictions of the multiplication and inversion morphisms of $X$ now make each $X_i$ a complete connected group variety, hence an abelian variety. Since the group law on $X$ is commutative,
$$
p((x_1,x_2)+(y_1,y_2))
=x_1+y_1+x_2+y_2
=p(x_1,x_2)+p(y_1,y_2).
$$
Thus $p$ is a homomorphism. It is already an isomorphism of varieties, and its inverse consequently respects the group operations as well, so $p$ is an isomorphism of group schemes.