4 added 147 characters in body

The abstract reason for this is that $\mathbb A^2$ satisfies Serre's property $(S_2)$ (which follows from being smooth) and hence every regular function is determined in codimension $1$. In other words, the point is that a regular function on $\mathbb A^2\setminus \{0\}$ is a rational function on $\mathbb A^2$ and the locus of indeterminacy of a rational function on $\mathbb A^2$ is of pure codimension $1$ (think of meromorphic functions on $\mathbb C^2$), so if you leave out something of codimension at least $2$, then you cannot get new regular functions. This implies that the natural injection of the ring of regular functions on $\mathbb A^2\setminus \{0\}$ into the ring of regular functions on $\mathbb A^2$ is an isomorphism, but then they can't be both affine as then they would have to be isomorphic. (Note that I did not just say that their rings of regular functions are isomorphic, but that the isomorphism is induced by the embedding).

More generally this argument shows that if $X$ is an affine variety of dimension at least $2$ and $P\in X$ is a closed point such that $\mathrm{depth}_P\mathscr O_X\geq 2$ (this is automatic if for example $X$ is normal, or a complete intersection in something smooth, or Cohen-Macaulay), then $X\setminus\{P\}$ is not affine.

This is an instance of Hartogs' theorem on extending holomorphic functions on normal complex analytic spaces. See this MO question for more.

The abstract reason for this is that $\mathbb A^2$ is satisfies Serre's property $S_2$ (S_2)$(which follows from being smooth) and hence every regular function is determined in codimension$1$. In other words, the point is that a regular function on$\mathbb A^2\setminus \{0\}$is a rational function on$\mathbb A^2$and the locus of indeterminacy of a rational function on$\mathbb A^2$is of pure codimension$1$(think of meromorphic functions on$\mathbb C^2$), so if you leave out something of codimension at least$2$, then you cannot get new regular functions. This implies that the injection of the ring of regular functions on$\mathbb A^2\setminus \{0\}$into the ring of regular functions on$\mathbb A^2$is an isomorphism, but then they can't be both affine as then they would have to be isomorphic. More generally this argument shows that if$X$is an affine variety of dimension at least$2$and$P\in X$is a closed point such that$\mathrm{depth}_P\mathscr O_X\geq 2$(this is automatic if for example$X$is normal, or a complete intersection in something smooth, or Cohen-Macaulay), then$X\setminus\{P\}$is not affine. This is an instance of Hartog's Hartogs' theorem on extending holomorphic functions on normal complex analytic spaces. See this MO question for more. 2 added 270 characters in body The abstract reason for this is that$\mathbb A^2$is$S_2$(which follows from being smooth) and hence every regular function is determined in codimension$1$. In other words, the point is that a regular function on$\mathbb A^2\setminus \{0\}$is a rational function on$\mathbb A^2$and the locus of indeterminacy of a rational function on$\mathbb A^2$is of pure codimension$1$(think of meromorphic functions on$\mathbb C^2$), so if you leave out something of codimension at least$2$, then you cannot get new regular functions. This implies that the injection of the ring of regular functions on$\mathbb A^2\setminus \{0\}$into the ring of regular functions on$\mathbb A^2$is an isomorphism, but then they can't be both affine as then they would have to be isomorphic. More generally this argument shows that if$X$is an affine variety of dimension at least$2$and$P\in X$is a closed point such that$\mathrm{depth}_P\mathscr O_X\geq 2$(this is automatic if for example$X$is smoothnormal, or a complete intersection in something smooth, or more generally Cohen-Macaulay), then$X\setminus\{P\}\$ is not affine.