Here is my attempted proof:
Suppose $e_1$ is the identity of $G_1$ and likewise $e_2$ is the identity of $G_2$. Then we have to show $f(e_1)=e_2$.
Since $f$ is an isomorphism, $f$ is bijective and hence surjective. Therefore, $f(x)=e_2$ for some $x\in G_1$.
Also, $f(x\cdot e_1)=e_2$. This implies $f(x)f(e_1)=e_2$. Also the product of $f(x)$ and $f(e_1)$ gives the identity, hence they must be inverses of each other, i.e. $f(e_1)=f(x)^{-1}$. But $f(x)=e_2$ and hence $f(e_1)=e_{2}^{-1}=e_2$.
Is my proof correct? Are there any alternative ways?
Your proof is correct, but you are explicitly using surjectivity. You don't actually need this, but instead all you need is for the map $f$ to be a homomorphism (so not necessarily a surjective or injective):
Proof. Write $g:=f(e_1)$. Then $g^2=f(e_1)^2=f(e_1^2)=f(e_1)=g$. That is, $g^2=g$. Then: $$\begin{align*} g^2&=g\\ \Rightarrow g^2\cdot g^{-1}&=g\cdot g^{-1}\\ \Rightarrow g&=e_2 \end{align*}$$ Therefore, $f(e_1)=e_2$ as required.