If the map from $X$ to the maxspec of $\mathcal O(X)$ is a bijection, then $X$ is indeed affine.
Here is an argument:
By assumption $X \to $ maxspec $\mathcal O(X)$ is bijective, thus quasi-finite,
and so by (Grothendieck's form of) Zariski's main theorem, this map factors as an open embedding of $X$ into a variety that is finite over maxspec $\mathcal O(X)$.
Any variety finite over an affine variety is again affine, and hence $X$ is an open subset of an affine variety, i.e. quasi-affine. So we are reduced to considering the case when $X$ is quasi-affine, which is well-known and straightforward.
(I'm not sure that the full strength of ZMT is needed, but it is a natural tool
to exploit to get mileage out of the assumption of a morphism having finite fibres, which is what your bijectivity hypothesis gives.)
In fact, the argument shows something stronger: suppose that we just assume
that the morphism $X \to $ maxspec $\mathcal O(X)$ has finite non-empty fibres,
i.e. is quasi-finite and surjective.
Then the same argument with ZMT shows that $X$ is quasi-affine. But it is standard that the map $X \to $ maxspec $\mathcal O(X)$ is an open immersion when $X$ is quasi-affine,
and since by assumption it is surjecive, it is an isomorphism.
Note that if we omit one of the hypotheses of surjectivity or quasi-finiteness, we can find a non-affine $X$ satisfying the other hypothesis.
E.g. if $X = \mathbb A^2 \setminus \{0\}$ (the basic example of a quasi-affine,
but non-affine, variety), then maxspec $\mathcal O(X) = \mathbb A^2$, and the open immersion $X \to \mathbb A^2$ is evidently not surjective.
E.g. if $X = \mathbb A^2$ blown up at $0$, then maxspec $\mathcal O(X) =
\mathbb A^2$, and $X \to \mathbb A^2$ is surjective, but has an infinite fibre
over $0$.
Caveat/correction: I should add the following caveat, namely that it is not always true, for a variety $X$ over a field $k$, that $\mathcal O(X)$ is finitely generated over $k$, in which case maxspec may not be such a good construction to apply, and the above argument may not go through. So in order to conclude that $X$ is affine, one should first insist that $\mathcal O(X)$ is finitely generated over $k$, and then that futhermore the natural map $X \to $ maxspec $\mathcal O(X)$ is quasi-finite and surjective.
(Of course, one could work more generally with arbitrary schemes and Spec rather than
maxspec, but I haven't thought about this general setting: in particular, ZMT requires some finiteness hypotheses, and I haven't thought about what conditions might guarantee that the map $X \to $ Spec $\mathcal O(X)$ satisfies them.)
Incidentally, for an example of a quasi-projective variety with non-finitely generated ring of regular functions, see this note of Ravi Vakil's
Note that you write $X \times Y \subset \mathbb A^{m+n}$, and so you seem to be using almost without thinking about the isomorphism $\mathbb A^m\times \mathbb A^n \cong \mathbb A^{m+n}$.
Okay, now for your question:
Forget about the equations, and just consider $\mathbb P^m \times \mathbb P^n$. What straightforward way might you suggest to think of this as a variety?
Once you can do this case, you can do any quasi-projective case. So you should think about the role of the Segre embedding in this case.
Best Answer
Edit Remove some false statements on the general situation.
Counterexample. Let $X=\mathbb P^2\setminus \{ \text{one closed point}\}$ over a field $k$. Suppose $X$ is closed in a $P\times A$ with $P$ projective and $A$ affine. Composing with projection then gives a morphism $p: X\to A$. As $A$ is affine, this morphism corresponds to a homomorphism $O(A)\to O(X)=k$ of $k$-algebras and is given by $X\to \mathrm{Spec}(O(X))\to A$. Therefore $p$ is constant and $X$ is a closed subscheme of $P\times \{ p(X) \}$ which is projective. But $X$ is not projective !
More generally, there is a notion of anti-affine varieties which don't have non-constant morphisms to any affine variety. Any non projective anti-affine variety is a counterexample to your question.
Remark The properties : being a closed variety of a product $\mathbb P^n\times \mathbb A^m$; projective over an affine varietiy; affine over a projective are clearly equivalent. And the examples in the answers show that this is a strictly stronger condition than being quasi-projective.
There is one way (probably useless) to characterize varieties $X$ which are embeddable in a $\mathbb P^n\times \mathbb A^m$: namey, $O_X(X)$ is finitely generated $k$-algebra and the canonical morphism $X\to \mathrm{Spec}(O(X)) $ is projective. The only non-trivial point is the "only if" part. Suppose $X$ can be embedded in some $\mathbb P^n\times \mathbb A^m$. Composing with the projection to $\mathbb A^m$, we get a projective morphism $f: X\to \mathbb A^n_k$. By the theorem of direct image $O(X)$ is finite over $O(\mathbb A^n)$. So this is a finitely generated $k$-algebra. The morphism $f$ factorizes through $X\to\mathrm{Spec}(O(X))\to \mathbb A^m$. This implies that the first morphism is projective.
This gives another way to provide examples of quasi-projective varieties which are not embeddable into $\mathbb P^n\times \mathbb A^m$: it suffices that $O(X)$ is not f.g. over $k$. Such $X$ exist with $X$ quasi-affine (Nagata, related to Hilbert's 14th Problem).