2 added 1 characters in body

Assume for contradiction that $U$ is affine. Then regular functions on $U$ separate points. On the other hand a regular function on $U$ extends to a rational function on $S$ with poles at most on $\Delta$, namely to a section of $H^0({\mathcal O}_S(n\Delta))$. If $g>1$, $h^0({\mathcal O}_X(n\Delta))=1$ for very every $n\ge 0$, and we have a contradiction.
If $g=1$, then $\Delta$ is a fiber of the morphism $X\times X\to X$ defined by $(x,y)\mapsto x-y$, hence $U$ is fibered in smooth elliptic curves and therefore it is not affine.
Assume for contradiction that $U$ is affine. Then regular functions on $U$ separate points. On the other hand a regular function on $U$ extends to a rational function on $S$ with poles at most on $\Delta$, namely to a section of $H^0({\mathcal O}_S(n\Delta))$. If $g>1$, $h^0({\mathcal O}_X(n\Delta))=1$ for very $n\ge 0$, and we have a contradiction.
If $g=1$, then $\Delta$ is a fiber of the morphism $X\times X\to X$ defined by $(x,y)\mapsto x-y$, hence $U$ is fibered in smooth elliptic curves and therefore it is not affine.