Let $L/K$ be a field extension and $a_1, \dots a_n\in L$, such that $a_1$ is algebraic over $K$, $a_2$ is algebraic over $K(a_1)$ and in general, $a_i$ is algebraic over $K(a_1, \dots , a_{i-1})$ for $i=2, \dots , n$. I want to show that $K(a_1, \dots , a_n)=K[a_1, \dots , a_n]$.
$$$$
I have done the following:
We have that $K[a]=\{f(a), f(x)\in K[x]\}$ and $K(a)=\{\frac{f(a)}{g(a)}, f(x), g(x)\in K[x] \text{ with } g(a)\neq 0\}=\{f(a)g(a)^{-1}, f(x), g(x)\in K[x] \text{ with } g(a)\neq 0\}$.
So, $K[a]\subseteq K(a)$.
Therefore, $$K[a_1, \dots , a_n]\subseteq K(a_1, \dots , a_n)$$ or not?
We have to show that $K[a_1, \dots , a_n]$ is a field, since then every element will be invertible.
Let $0\neq c\in K[a_1, \dots , a_n]$, then $c=f(a_1, \dots , a_n), f\in K[a_1, \dots , a_{i-1}, x]$.
Let $p(x)=\text{Irr}(a_n, K[a_1, \dots , a_{n-1}])$.
We have that $p(x)\not\mid f(a_1, \dots , a_{n-1})(x)$ since $p(a_n)=0$ but $f(a_1, \dots , a_n)\neq 0$.
So, $(p, f(a_1, \dots , a_{n-1}))=1\Rightarrow \exists h,g\in K[a_1, \dots , a_{n-1}, x]$ with $h(a_1, \dots , a_{n-1}, x)p(x)+g(a_1, \dots , a_{n-1}, x)f(a_1, \dots , a_n)=1\overset {x=a_n}{\Longrightarrow} g(a_1, \dots , a_{n-1}, a_n)f(a_1, \dots , a_n)=1$.
$$$$
Is this correct? Could I improve something?
The first set inclusion is good, since we can set $g(a_1, ..., a_n) = 1$ to show that $K[a_1, ..., a_n] \subseteq K(a_1, ..., a_n)$ for any $n \in \mathbb{N}$.
The other set inclusion is good as well, but it would've been even faster using induction. Since $K[a_1, ..., a_{n-1}][a_n] = K[a_1, ..., a_n]$, the induction step is automatically proven by the base case. Thus, all you really needed to show was that $K(a) = K[a]$ for any field $K$ and any $a \in \overline{K}$. The fundamental idea, however, is the same: every polynomial without $a$ as a root will correspond to a nonzero element in $F[a]$, and further, every such polynomial will be relatively prime the minimal polynomial of $a$. Therefore, one can use the Euclidean algorithm to find inverses as you suggest.