Let us call $x_1,\dots,x_n$ the coordinates on $X$ when viewed inside $\mathbb A^n$, and $y_1,\dots,y_n$ the coordinates on the other copy of $\mathbb A^n$ in the product $X\times\mathbb A^n$. Then, by definition, $$k[X\times\mathbb A^n]=k[x_1,\dots,x_n,y_1,\dots,y_n]/I(X\times \mathbb A^n),$$ where $I(X\times \mathbb A^n)\overset{(\ast)}{=}\sqrt{I(X)+I(\mathbb A^n)}=\sqrt{I(X)}=I(X)$. (I assume in the last equality that your variety is reduced. See e.g. here for $(\ast)$)
It is true that, using tensor product, you get the result. Indeed,
$$
k[X\times\mathbb A^n]\overset{(\ast\ast)}{=}k[X]\otimes_kk[\mathbb A^n]=k[X]\otimes_kk[y_1,\dots,y_n]\overset{(\sharp)}{\cong}k[X][y_1,\dots,y_n].
$$
For equality $(\ast\ast)$ you might look at the same page as before. For $(\sharp)$, it is a general fact that tensoring a $k$-algebra $B$ with a polynomial algebra $A:=k[y_1,\dots,y_n]$ gives you $B[y_1,\dots,y_n]$.
Here is a proof. One verifies that $B[y_1,\dots,y_n]$ satisfies the universal property of the tensor product $A\otimes_kB$. Indeed, one has two morphisms $A\to B[y_1,\dots,y_n]\leftarrow B$, and any other couple of morphisms $A\to C\leftarrow B$ factors uniquely through some $p:B[y_1,\dots,y_n]\to C$. Try to define such $p$.
However, it would be easy to show (without tensor products) that $k[x_1,\dots,x_n,y_1,\dots,y_n]/I(X)=k[x_1,\dots,x_n][y_1,\dots,y_n]/I(X)\cong k[X][y_1,\dots,y_n]$, because $y_1,\dots,y_n$ do not "intervene". You may try to define this isomorphism explicitly.