[proofplan]
The proof first identifies the Zariski closure of $Y$ with the common zero locus $V(I(Y))$. This follows directly from the definition of the Zariski topology and the order-reversing relation between containment of subsets and containment of vanishing ideals. Then density becomes the assertion that $V(I(Y))=\mathbb A_k^n$. Finally, because $k$ is infinite, the only polynomial in $k[x_1,\dots,x_n]$ vanishing on all of $k^n$ is the zero polynomial, so this equality is equivalent to $I(Y)=(0)$.
[/proofplan]
[step:Identify the closure of $Y$ as the zero locus of its vanishing ideal]
Let $R:=k[x_1,\dots,x_n]$. For an ideal $J\trianglelefteq R$, define
\begin{align*}
V(J):=\{a\in k^n: f(a)=0 \text{ for every } f\in J\}.
\end{align*}
By definition of $I(Y)$, every $f\in I(Y)$ vanishes at every point of $Y$, so $Y\subset V(I(Y))$. Hence $V(I(Y))$ is a Zariski closed subset of $\mathbb A_k^n$ containing $Y$.
Now let $C\subset \mathbb A_k^n$ be any Zariski closed subset with $Y\subset C$. Since closed subsets are common zero loci of families of polynomials, there is an ideal $J\trianglelefteq R$ such that $C=V(J)$. If $f\in J$ and $y\in Y$, then $y\in C=V(J)$, so $f(y)=0$. Therefore $J\subset I(Y)$. It follows that every point annihilating all polynomials in $I(Y)$ also annihilates all polynomials in $J$, hence
\begin{align*}
V(I(Y))\subset V(J)=C.
\end{align*}
Thus $V(I(Y))$ is contained in every Zariski closed subset containing $Y$, and since it is itself closed and contains $Y$, it is the Zariski closure $\overline{Y}$.
[guided]
Let $R:=k[x_1,\dots,x_n]$. For an ideal $J\trianglelefteq R$, define its zero locus by
\begin{align*}
V(J):=\{a\in k^n: f(a)=0 \text{ for every } f\in J\}.
\end{align*}
We want to identify the smallest Zariski [closed set](/page/Closed%20Set) containing $Y$. The natural candidate is $V(I(Y))$, because $I(Y)$ was defined to consist exactly of the polynomials that vanish on every point of $Y$.
First, $Y\subset V(I(Y))$. Indeed, if $y\in Y$ and $f\in I(Y)$, then the defining property of $I(Y)$ gives $f(y)=0$. Therefore $y$ satisfies all equations from $I(Y)$, and hence $y\in V(I(Y))$. Since $V(I(Y))$ is a common zero locus of polynomials, it is Zariski closed.
Now we prove minimality. Let $C\subset \mathbb A_k^n$ be any Zariski closed subset such that $Y\subset C$. By the definition of the [Zariski topology on affine space](/theorems/9408), there is an ideal $J\trianglelefteq R$ with $C=V(J)$. Take any $f\in J$. Since every point $y\in Y$ lies in $C=V(J)$, the polynomial $f$ vanishes at every $y\in Y$. Hence $f\in I(Y)$. This proves
\begin{align*}
J\subset I(Y).
\end{align*}
Zero loci reverse inclusions of ideals: if $J\subset I(Y)$, then a point satisfying every equation in $I(Y)$ certainly satisfies every equation in $J$. Therefore
\begin{align*}
V(I(Y))\subset V(J)=C.
\end{align*}
So $V(I(Y))$ is a closed set containing $Y$ and is contained in every closed set containing $Y$. This is precisely the Zariski closure of $Y$:
\begin{align*}
\overline{Y}=V(I(Y)).
\end{align*}
[/guided]
[/step]
[step:Reduce density to polynomials vanishing on all of affine space]
By the previous step,
\begin{align*}
\overline{Y}=V(I(Y)).
\end{align*}
Therefore $Y$ is Zariski dense in $\mathbb A_k^n$ if and only if $\overline{Y}=\mathbb A_k^n$, which is equivalent to
\begin{align*}
V(I(Y))=k^n.
\end{align*}
Thus it remains to characterize when every polynomial in $I(Y)$ vanishes on all of $k^n$.
[/step]
[step:Use infinitude of $k$ to rule out nonzero polynomials vanishing everywhere]
We use the following elementary polynomial identity lemma.
[claim:Polynomial identity lemma over an infinite field]
Let $m\in \mathbb N$. If $F\in k[x_1,\dots,x_m]$ satisfies $F(a)=0$ for every $a\in k^m$, then $F=0$.
[/claim]
[proof]
If $m=0$, then $k[x_1,\dots,x_m]=k$. A constant $F\in k$ vanishes at the unique point of $k^0$ precisely when $F=0$.
Assume $m\ge 1$. We argue by induction on $m$. For $m=1$, a nonzero polynomial in $k[x_1]$ has degree $d\ge 0$ and has at most $d$ roots in the field $k$. Since $k$ is infinite, it cannot vanish at every element of $k$. Hence a polynomial in $k[x_1]$ vanishing on all of $k$ must be zero.
Now assume the result holds for $m-1$, where $m\ge 2$. Write $F$ as a polynomial in $x_m$ with coefficients in $k[x_1,\dots,x_{m-1}]$:
\begin{align*}
F=\sum_{j=0}^d F_j x_m^j
\end{align*}
for some integer $d\ge 0$ and coefficient polynomials $F_j\in k[x_1,\dots,x_{m-1}]$. Fix $b=(b_1,\dots,b_{m-1})\in k^{m-1}$. Define the one-variable polynomial $F_b\in k[x_m]$ by
\begin{align*}
F_b(x_m):=F(b_1,\dots,b_{m-1},x_m).
\end{align*}
By hypothesis, $F_b(t)=0$ for every $t\in k$. The one-variable case gives $F_b=0$, so each coefficient satisfies $F_j(b)=0$. Since this holds for every $b\in k^{m-1}$, the induction hypothesis gives $F_j=0$ for every $j$. Therefore $F=0$.
[/proof]
Suppose first that $I(Y)=(0)$. Then $V(I(Y))=V((0))=k^n$, because the zero polynomial vanishes at every point of $k^n$. Hence $Y$ is dense by the previous step.
Conversely, suppose $Y$ is dense. Then $V(I(Y))=k^n$. Let $f\in I(Y)$. Since $V(I(Y))=k^n$, the polynomial $f$ vanishes at every point of $k^n$. By the polynomial identity lemma over the infinite field $k$, applied with $m=n$ and $F=f$, we get $f=0$. Hence every element of $I(Y)$ is zero, so $I(Y)=(0)$.
[/step]
[step:Conclude the equivalence]
We have shown that
\begin{align*}
Y \text{ is Zariski dense in } \mathbb A_k^n \iff V(I(Y))=k^n \iff I(Y)=(0).
\end{align*}
This proves the desired density criterion.
[/step]