I believe this question is very dumb.
We know the following proposition from Algebraic Number Theory, by J. Milne:
In particular, if $[K:\mathbb{Q}]=n$, then the ring of integers $\mathcal{O}_{K}$ is a free $\mathbb{Z}$-module of rank $n$.
Since $K$ is a finite extension of $\mathbb{Q}$, then $K=\mathbb{Q}(\alpha)$ for some $\alpha \in \mathcal{O}_{K}$. The minimal polynomial for $\alpha$ has degree $n$ and $\{1,\alpha,...,\alpha^{n-1}\}$ form a basis of $K$ as $\mathbb{Q}$-vector space. In particular, $\{1,\alpha,...,\alpha^{n-1}\}$ is $\mathbb{Z}$-linearly independent.
So, I have a set linearly independent with $n$ elements. I believe it is a basis for $\mathcal{O}_{K}$ as $\mathbb{Z}$-module. Therefore $\mathcal{O}_{K}=\mathbb{Z}[\alpha]$. But it is not true in general.
For example, if I take $K=\mathbb{Q}(\theta)$ where $\theta^{3}+\theta^{2}-2\theta+8=0$. Then $\{1,\theta,\theta^{2}\}$ is not a basis because $\beta =\frac{\theta+\theta^{2}}{2}$ is algebraic integer and $\beta \notin \mathbb{Z}[\theta]$.
I would like to understand why there is no contradiction between the proposition and the set $\{1,\alpha,...,\alpha^{n-1}\}$ is not always a basis for $\mathcal{O}_{K}$.
I believe that the problem is that I can have a linearly independent set with n element, n = rank of the free module, but this set does not span the free module.