Let $Y\subseteq \mathbb{A}_k^n$ be an affine variety and $X$ any other (quasi)-(projective) variety with $U$ an open-subset of $X$.
If $\theta: A(Y) \to \mathcal{O}(U)$ is a $k$-algebra homomorphism we can define $\theta': U\to Y$ as a morphism by, $$ \theta'(p) = (\theta(x_1)(p), .... , \theta(x_n)(p) )$$
If $\theta$ is injective why does it follow that $(U,\theta')$ is dominant rational map in $\hom(X,Y)$?
This construction is used by Hartshorne, AG, page 26.
Suppose that $\theta'$ was not dominant. It means that the image of $\theta'$ lies in a proper closed subset of $Y$.
Then we write $\theta'(U)\subseteq Y\cap Z(g)$ where $g\neq 0$ is an irreducible polynomial in $A(Y)$. This means that $g(\theta'(x))=0$ for all $x\in U$.
But by the correspondence between $\theta$ and $\theta'$, $0=g(\theta'(x))=\theta(g)(x)$, for all $x\in U$. We just showed that $\theta(g)=0$ in $\mathcal{O}(U)$, with $g\neq 0$, hence $\theta$ is not injective.
You can also prove the converse, reading the proof backwards.