$o(g)$ denotes the order of $g$.
This is how I think I proved it:
Let $m:=o(g)$
Let $d=o(\phi(g))$. $~d\le m$ because $\langle\phi (g)\rangle=\{\phi(g),\phi(g)^2=\phi(g^2),...,\phi(g^m)=e_{G_2}\}$
If $o(\phi(g))=d$ by euclidean division there exist $q\in\Bbb N$ and $0\le r<d$ such that $$m=dq+r~\text{ and }~\phi(g)^d=e=\phi(g^d)\\ e=g^m=g^{dq+r}=g^{dq}g^r \implies g^r=g^{-dq}\\ \phi(g)^r=\phi(g^r)=\phi(g^{-dq})=(\phi(g)^d)^{-q}=e$$ but $d>r$ is the order of $\phi(g)$ so $r$ must be zero.
I'm not sure if this is all correct
You can get this more quickly using the First Isomorphism Theorem. Recall that $o(g) = |\langle g \rangle|$. Now $o(\phi(g)) = |\phi( \langle g \rangle)|$. Taking $G = \langle g \rangle$, the First Isomorphism theorem tells us that $|G| = |Im(\phi)| \cdot |\ker(\phi)|$. Note that $|Im(\phi)| = o(\phi(g))$.