$\newcommand{\Spec}{\operatorname{Spec}}
\newcommand{\Sch}{\text{Sch}}
\newcommand{\Affsch}{\text{Affsch}}$(1) No, the scheme $X=\bigsqcup X_i$ is not affine (unless almost all $X_i$ are empty!) because its underlying topological space $|X|=\bigsqcup |X_i|$ is not quasi-compact.
(2) Yes, $\Gamma (X,\mathcal O_X)$ is determined by the formula $$\Gamma (X,\mathcal O_X)=\prod \Gamma (X_i,\mathcal O_{X_i})=\prod A_i$$
Remarks
a) The scheme $X$ has as underlying topological space $| X|=\bigsqcup | X_i|$, as already mentioned, and its structure sheaf is the unique sheaf of rings $\mathcal O_X$ satisfying $\mathcal O_X|_{ X_i}=\mathcal O_{X_i}$.
[O my dear nitpicking brothers , notice that "unique" here really means unique, and not unique up to isomorphism!]
b) In order to prevent any misunderstanding, let me emphasize that the scheme $X$ is the coproduct of the schemes $X_i$ in the category of all schemes (not in the category of affine schemes!).
In other words, the open immersions $u_i :X_i\hookrightarrow X$ produce bijections $\operatorname{Hom}_{\Sch}(X,Y)=\prod \operatorname{Hom}_{\Sch}(X_i,Y): f\mapsto f\circ u_i$ which are functorial in the scheme $Y$.
Edit
c) Beware the subtle fact that the family of affine schemes $X_i=\Spec(A_i)$ also has a coproduct in the category $\Affsch$ of affine schemes, namely $X'=\Spec(\prod A_i)$.
There is a canonical morphism of schemes $$\alpha: X=\bigsqcup_{\Sch} X_i \to X'=\bigsqcup_{\Affsch} X_i=\Spec(\prod A_i)$$ of the coproduct of the $X_i$'s in the category of all schemes to the coproduct of the $X_i$'s in the category of affine schemes.
This morphism $\alpha$ is determined by its restrictions $\alpha|_{X_j}:X_j=\Spec(A_j)\to \Spec(\prod A_i)$, which are dual to the ring projections $\prod A_i\to A_j$.
And finally, let me insist: this canonical morphism $\alpha$ is an isomorphism of schemes if and only the family of schemes $(X_i)$ is a finite family.
[This edit is the consequence of a pleasant discussion with my friend and very competent colleague Dehon: thanks François-Xavier!]