Conditions under which a group homomorphisms between products of groups arises as a product of homomorphisms Let $\phi: G\times H\to G\times H$ be a group homomorphism. Under what conditions can we write $\phi=(f,g)$, where $f:G\to G$ and $g:H\to H$, where $f$, $g$ are group homomorphisms?

$\phi : G \times H \to G \times H$ is determined uniquely by its values on the natural embeddings of $G$ and $H$, since $\phi(g,h) = \phi(g,1) \phi(1,h)$.
We restrict $f$ to these natural embeddings to get functions $f_G : G \to G \times H$ and $f_H : H \to G \times H$. Then the function $(f_G, f_H) : G\times H \to G \times H$ defined by $(f_G, f_H)(g,h) = (f_G(g),f_H(h))$ agrees with $\phi$, so is equal to $\phi$.
So, all the time.
