Product of connected spaces
Let $F : A \times B \to \{0,1\}$ be a continuous functions. To show that $A\times B$ is connected for the product topology we have to show that $F$ is constant.
As you suggested (kind of) we first show that $F$ is constant on every set of the form $\{a\}\times B$. Indeed if we have $a\in A$ we get a function $f:B \to \{0,1\}$ defined by $b \mapsto F(a,b)$. This functions is continuous thus constant because $B$ is connected.
In the exact same way we can show that $F$ is constant on the sets of the form $A \times \{b\}$.
We now show that this implies that $F$ is constant on $A\times B$. Indeed fix $(a,b) \in A \times B$. Now let's consider another point $(a',b')\in A \times B$. By what we have done earlier we have $F(a,b)=F(a,b')=F(a',b')$. We are done.
Theorem. If $\{X_i\}_{i\in I}$ is a family of connected spaces such that $\bigcap_{i\in I} X_i\neq \emptyset$ then $\bigcup_{i\in I} X_i$ is connected.
Using this it is easy to prove what you want:
Fix $y\in Y$ and consider for every $x\in X$ the set, $$U_x=(\{x\}\times Y)\cup (X\times \{y\}).$$ Then every $U_x$ is connected for it is union of connected sets ($\{x\}\times Y\simeq Y$ and $X\times \{y\}\simeq X$) with non-empty intersection ($(\{x\}\times Y)\cap (X\times \{y\})=(x, y)$). It is easy to see $$X\times Y=\bigcup_{x\in X} U_x,$$ and since $\displaystyle \bigcap_{x\in X} U_x=X\times \{y\}\neq \phi$, $X\times Y$ is connected.
Suppose $U , V \subseteq A \times B$ are disjoint open sets whose union is all of $A \times B$. Fixing some $b \in B$, note that the subspace $A \times \{ b \}$ of $A \times B$ is homeomorphic to $A$, and $A \times \{ b \} \subseteq U \cup V$. By the connectedness $A$ (and hence of $A \times \{ b \}$) we may conclude, without loss of generality, that $A \times \{ b \} \subseteq U$.
Now given $a \in A$, knowing that $\langle a , b \rangle \in U$ go through a similar argument as above to conclude that $\{ a \} \times B \subseteq U$.