No, your condition is not enough.
For example, take two distinct finite nonabelian simple groups $G$ and $H$ such that neither one is a subgroup of the other (such pairs exist; the condition is in fact stronger than it needs to be, as witnessed by the theorem quoted in the end; you just need $G$ and $H$ to be distinct). By the odd-order theorem, both $|G|$ and $|H|$ are even, so $\gcd(|G|,|H|)\neq 1$.
Let $\iota_G$ and $\iota_H$ be the inclusions into the product, and $\pi_G$, $\pi_H$ the projections. Let $f\colon G\times H \to G\times H$ be an automorphism.
Then $\pi_H\circ f\circ\iota_G \colon G\to H$ is a homomorphism. Since $H$ does not contain a subgroup isomorphic to $G$ and $G$ is simple, the composition must be the trivial map. Therefore, $f(g,e)\in G\times\{e\}$ for all $g\in G$. Symmetrically, by looking at $\pi_G\circ f\circ \iota_H$, we conclude that $f(e,h)\in \{e\}\times H$ for all $h\in H$. Therefore, $f|_{G\times\{e\}} = \alpha\in \mathrm{Aut}(G)$, and $f|_{\{e\}\times H} = \beta\in \mathrm{Aut}(H)$. So every automorphism of $G\times H$ corresponds to an element of $\mathrm{Aut}(G)\times\mathrm{Aut}(H)$, and of course the restrictions completely determine $f$.
You may want to consider:
Bidwell, J.N.S., Curran, M.J., and McCaughan, D. Automorphisms of direct products of finite groups, Arch. Math. (Basel) 86 (2006) no. 6, 481-489
Bidwell, J.N.S. Automorphisms of direct products of finite groups II. Arch. Math. (Basel) 91 (2008) no. 2, 111-121.
An example of a theorem of the first one is:
Theorem. Let $G=H\times K$, where $H$ and $K$ have no common direct factor. Then $\mathrm{Aut}(G)\cong \mathcal{A}$, where
$$\mathcal{A} = \left.\left\{\left(\begin{array}{cc}\alpha&\beta\\\gamma&\delta\end{array}\right)\;\right|\; \alpha\in\mathrm{Aut}(H), \delta\in\mathrm{Aut}(K), \beta\in\mathrm{Hom}(K,Z(H)), \gamma\in\mathrm{Hom}(H,Z(K))\right\}.$$
In particular,
$$|\mathrm{Aut}(G)| = |\mathrm{Aut}(H)||\mathrm{Aut}(K)||\mathrm{Hom}(H,Z(K))||\mathrm{Hom}(K,Z(H))|.$$
Best Answer
For every integer $n \geq 2$, the homomorphisms of $\mathbf Z/(n) \times \mathbf Z/(n)$ to itself are the linear maps given by $2 \times 2$ mod $n$ matrices $A = (\begin{smallmatrix}a&b\\c&d\end{smallmatrix})$, which act on $\mathbf Z/(n) \times \mathbf Z/(n)$ by $A\binom{x}{y} = \binom{ax+cy}{bx+dy}$. This homomorphism is invertible if and only if the matrix is invertible, which means $\det A$ is invertible mod $n$. Such $A$ form the group ${\rm GL}_2(\mathbf Z/(n))$ of invertible $2 \times 2$ mod $n$ matrices. So ${\rm Aut}(\mathbf Z/(n) \times \mathbf Z/(n)) = {\rm GL}_2(\mathbf Z/(n))$.
By similar reasoning, for all $d \geq 1$ we have ${\rm Aut}(({\mathbf Z}/(n))^d) = {\rm GL}_d(\mathbf Z/(n))$, where $d \times d$ mod $n$ matrices act on vectors in $(\mathbf Z/(n))^d$ in the natural way.
A very simple reason ${\rm Aut}(G \times G)$ is not pairs of automorphisms of $G$, when $G$ is a nontrivial group, is that there is always the swap automorphism $f(g,g') = (g',g)$.