Let $M,N$ be nonempty, smooth manifold of the same dimension. Let $N$ be compact and $M$ be connected. Suppose that $f:N\rightarrow M$ is an embedding. We want to show that $f$ is a diffeomorphism.
Since $f$ is an embedding, then we know that
$f(N)\subset M$ is a smooth submanifold, and
$f:N\rightarrow f(N)$ is a diffeomorphism. That is we identify the domain $N$ with its image $f(N)\subset M$ such that $N\subset M$.
We would like to show that $f$ is a diffeomorphism. So, we need to show $f$ is an invertible smooth map.