As far as I understand, an automorphism is an isomorphism from a set to itself. If we have a homomorphism $f:M\rightarrow M$, then, from the first isomorphism theoreom, $im(f)$ is a submodule of $M$. As it is injective, the kernel is zero, and hence the image is isomorphic to $M$.
Does this not show that $f$ is an isomorphism from $M$ to itself? What am I missing?
Not in general. For example, if your base ring is $\mathbb{Z}$, and you take the map from $\mathbb{Z}$ to itself multiplying every element by $2$, this map is injective, but is not an automorphism.
However, the statement is true if $M$ is an Artinian module, as can be seen in this question.