[proofplan]
The forward direction is the coordinate-ring description of restriction to a closed subvariety: if $X$ is isomorphic to a closed subvariety $Z\subset Y$, then functions on $Z$ are obtained by quotienting functions on $Y$ by those vanishing on $Z$. Conversely, if $\iota^*$ is surjective, its kernel $K$ cuts out a closed subvariety $Z\subset Y$ containing the image of $\iota$. Surjectivity makes $k[Y]/K$ isomorphic to the reduced ring $k[X]$, so $K$ is radical and therefore $k[Z]=k[Y]/K$. The induced map $X\to Z$ then has an isomorphism on coordinate rings, hence is an isomorphism of affine varieties by the affine coordinate-ring dictionary.
[/proofplan]
[step:Restrict functions from the ambient variety in the closed embedding case]
Assume first that $\iota:X\to Y$ is a closed embedding. By definition, there exists a closed subvariety $Z\subset Y$, an isomorphism of affine varieties
$\varphi:X\to Z$, and the inclusion map
$j:Z\to Y$
such that
\begin{align*}
\iota=j\circ \varphi.
\end{align*}
Let $I_Y(Z)\trianglelefteq k[Y]$ denote the ideal of regular functions on $Y$ vanishing on $Z$. By the definition of the coordinate ring of a closed subvariety,
\begin{align*}
k[Z]\cong k[Y]/I_Y(Z).
\end{align*}
Under this identification, the pullback
\begin{align*}
j^*:k[Y]\to k[Z]
\end{align*}
is the quotient map, hence is surjective.
Since $\varphi:X\to Z$ is an isomorphism of affine varieties, its pullback
\begin{align*}
\varphi^*:k[Z]\to k[X]
\end{align*}
is an isomorphism of $k$-algebras. Therefore
\begin{align*}
\iota^*=(j\circ\varphi)^*=\varphi^*\circ j^*
\end{align*}
is a composition of a surjective homomorphism with an isomorphism, and hence is surjective.
[/step]
[step:Cut out the closed image candidate by the kernel of the pullback]
Assume conversely that
\begin{align*}
\iota^*:k[Y]\to k[X]
\end{align*}
is surjective. Define
\begin{align*}
K:=\ker(\iota^*)\trianglelefteq k[Y].
\end{align*}
Let $Z\subset Y$ be the closed subvariety defined by $K$ inside $Y$:
\begin{align*}
Z:=V_Y(K)=\{y\in Y:f(y)=0\text{ for every }f\in K\}.
\end{align*}
We claim that $\iota(X)\subset Z$. Let $p\in X$ and let $f\in K$. Since $f\in\ker(\iota^*)$, we have $\iota^*(f)=0$ in $k[X]$. Evaluating this regular function at $p$ gives
\begin{align*}
0=(\iota^*f)(p)=f(\iota(p)).
\end{align*}
Thus every $f\in K$ vanishes at $\iota(p)$, so $\iota(p)\in Z$. Therefore $\iota$ factors through the inclusion $j:Z\to Y$. Denote the resulting regular map by
\begin{align*}
\varphi:X\to Z,
\end{align*}
so that
\begin{align*}
\iota=j\circ\varphi.
\end{align*}
[guided]
The purpose of $K=\ker(\iota^*)$ is to record exactly which regular functions on $Y$ become zero after restriction along $\iota$. We define
\begin{align*}
Z:=V_Y(K)=\{y\in Y:f(y)=0\text{ for every }f\in K\}.
\end{align*}
This is closed in $Y$ by the definition of the Zariski topology on an affine variety.
Now we verify that the image of $\iota$ lies in $Z$. Choose a point $p\in X$ and a function $f\in K$. The statement $f\in K$ means precisely that $\iota^*(f)=0$ as an element of $k[X]$. Since pullback is evaluation after applying the map $\iota$, we have
\begin{align*}
(\iota^*f)(p)=f(\iota(p)).
\end{align*}
Because $\iota^*(f)=0$, the left-hand side is $0$, and therefore
\begin{align*}
f(\iota(p))=0.
\end{align*}
This holds for every $f\in K$, so by the defining condition for $Z$ we get $\iota(p)\in Z$. Since $p\in X$ was arbitrary, $\iota(X)\subset Z$.
Hence the same point map as $\iota$ can be regarded as a map into $Z$. We denote it by
\begin{align*}
\varphi:X\to Z.
\end{align*}
If $j:Z\to Y$ is the inclusion, then the original map factors as
\begin{align*}
\iota=j\circ\varphi.
\end{align*}
[/guided]
[/step]
[step:Identify the coordinate ring of the closed subvariety cut out by the kernel]
Since $\iota^*$ is surjective with kernel $K$, the [first isomorphism theorem for rings](/theorems/851) gives a $k$-algebra isomorphism
\begin{align*}
k[Y]/K\cong k[X].
\end{align*}
The coordinate ring $k[X]$ is reduced because $X$ is an affine variety. Hence $k[Y]/K$ is reduced, so $K$ is a radical ideal of $k[Y]$.
By the affine [closed set](/page/Closed%20Set) radical correspondence [citetheorem:9414], applied inside the affine variety $Y$, the radical ideal $K$ is exactly the ideal of functions on $Y$ vanishing on $Z=V_Y(K)$:
\begin{align*}
I_Y(Z)=K.
\end{align*}
Therefore
\begin{align*}
k[Z]\cong k[Y]/I_Y(Z)=k[Y]/K.
\end{align*}
[/step]
[step:Show the induced pullback is an isomorphism]
Consider the pullback of the factored map
\begin{align*}
\varphi^*:k[Z]\to k[X].
\end{align*}
Using the identification $k[Z]\cong k[Y]/K$, an element of $k[Z]$ is represented by a class $\overline{f}$ with $f\in k[Y]$, and
\begin{align*}
\varphi^*(\overline{f})=\iota^*(f).
\end{align*}
This formula is well-defined because if $\overline{f}=\overline{g}$ in $k[Y]/K$, then $f-g\in K=\ker(\iota^*)$, so
\begin{align*}
\iota^*(f-g)=0,
\end{align*}
and hence $\iota^*(f)=\iota^*(g)$.
The homomorphism $\varphi^*$ is injective because its kernel consists exactly of classes $\overline{f}$ with $\iota^*(f)=0$, equivalently $f\in K$, equivalently $\overline{f}=0$ in $k[Y]/K$. It is surjective because $\iota^*:k[Y]\to k[X]$ is surjective. Hence
\begin{align*}
\varphi^*:k[Z]\to k[X]
\end{align*}
is an isomorphism of $k$-algebras.
[/step]
[step:Apply the affine dictionary to conclude that the map is a closed embedding]
By the affine variety coordinate-ring dictionary [citetheorem:9416], equivalently by the correspondence between regular maps and coordinate-ring homomorphisms [citetheorem:9420], a regular map of affine varieties whose pullback is an isomorphism of coordinate rings is an isomorphism of affine varieties. Applying this to
\begin{align*}
\varphi:X\to Z,
\end{align*}
we conclude that $\varphi$ is an isomorphism.
Since $Z\subset Y$ is a closed subvariety and
\begin{align*}
\iota=j\circ\varphi
\end{align*}
with $j:Z\to Y$ the inclusion, the map $\iota$ identifies $X$ isomorphically with the closed subvariety $Z$ of $Y$. Therefore $\iota$ is a closed embedding. This proves the converse direction and completes the proof.
[/step]