Clearly I suppose to put the condition $n > 1$ in use. So my proof must went wrong.. Could someone help me take a look at it? Thanks!
Suppose $X$ is a smooth, compact, connected $n$-manifold without boundary which admits an immersion to $S^n$. Show that if $n > 1$, then this immersion is a diffeomorphism.
By local immersion theorem,
Local Immersion Theorem Suppose that $f: X \to Y$ is an immersion at $x$, and $y = f(x)$. Then there exist local coordinates around $x$ and $y$ such that $$f(x_1, \dots, x_k) = (x_1, \dots, x_k, 0, \dots, 0).$$ In other words,$x$ is locally equivalent to the canonical immersion near $x$.
Therefore, the image of $f$ is open, since $(x_1, \dots, x_k)$ is open in $X$ so $(x_1, \dots, x_k, 0, \dots, 0)$ is open in $Y$. Also, because $X$ is compact, $f$ is proper. Therefore, $f$ is an embedding. According to the theorem, $f$ is an embedding.
Theorem An embedding $f: X \to Y$ maps $X$ diffeomorphically onto a submanifold of $Y$.
However, continuous functions preserves compactness, hence the image of $f$ is closed. The only closed and open subset of $Y$ is $Y$ itself. Hence $f$ is surjective. Therefore, since $f$ maps $X$ diffeomorphically onto a submanifold of $Y$, the submanifold is $Y$. And consequently, $f$ is a diffeomorphism.