Let $X\subseteq A^m$ and $Y\subseteq A^n$ be affine varieties with affine algebras $K[X]$ and $K[Y]$, respectively. Why is every $K$-algebra homomorphism $\theta\colon K[Y]\to K[X]$ obtained as the comorphism of a morphism $\phi\colon X\to Y$?
We know that $K[Y]=K[T_1,\ldots,T_n]/\mathscr{I}(Y)$, so if we let $t_i$ denote the equivalence class of $T_i$ then $\theta$ is uniquely determined by its values on the $t_i$. We can define a morphism $\phi\colon X\to A^n$ as $\phi(x)=(\psi_1(x),\ldots,\psi_n(x))$, where $\psi_i=\theta(t_i)$. If we know that $\phi(X)\subseteq Y$, then it is clear that $\phi^*=\theta$ as they agree on the $t_i$, where $\phi^*$ is the induced comorphism of $\phi$. However, how do we know that $\phi(X)\subseteq Y$?