Let $K$ be a field and $A$ a finitely generated $K$-algebra (here, $A$ is also commutative and has a unit).
I'm trying to prove the well-known result that $A$ is a domain if and only if $A$ is a field.
I don't know how to prove that and I'm confused by this example: if $A=K[xy]$, we have that $A\subset K[x,y]$, so it is a finitely generated $K$-algebra. It is clearly a domain, but it is not a field, since $xy$ has no inverse.
What am I missing?