Is there a nontrivial semidirect product of two groups isomorphic to their direct product?

In general, if ${\rm Im}(\phi) \le {\rm Inn}(N)$ then $N \rtimes_{\phi} H \cong N \times H$. So the smallest example is with $N=S_3$ and$|H|=2$.

Added later: unfortunately, what I wrote is not true in general! For example, let $G$ be a central product of the quaternion group $Q_8$ of order 8 (the dihedral group of order 8 would work, too) with a cyclic group $C_4$ of order 4, amalgamating the central subgroups of order 2 from the two groups. So $|G|=16$. Then, the product $xy$ of $x \in Q_8$ and $y \in C_4$ with $|x|=|y|=4$ has order 2, and so $G$ is a semidirect product $Q_8 \rtimes C_2$ where the automorphism induced by the action is inner, but it is not isomorphic to $Q_8 \times C_2$.

What you can say, is that if ${\rm Im}(\phi) \le {\rm Inn}(N)$ in $G = N \rtimes_{\phi} H$, then $G=NC_G(N)$ so, if $Z(N)=1$ (which is the case in the example above with $N=S_3$), then we do have $G \cong N \times H$.


Consider $N=A^{\mathbb N}\times B^{\mathbb N}\times C^{\mathbb N}$ and $H=B$, where $C=A\rtimes_\phi B$. Let $\Phi(h)(a_0, a_1, \ldots; b_0, b_1, \ldots; c_0, c_1, \ldots)=(\phi(h)(a_0), a_1, \ldots; b_0, b_1, \ldots; c_0, c_1, \ldots)$. This makes $$ B\rtimes_\Phi (A^{\mathbb N} \times B^{\mathbb N}\times C^{\mathbb N})\cong(B\rtimes_\phi A)\times A^{\mathbb N}\times B^{\mathbb N}\times C^{\mathbb N}=C\times A^{\mathbb N} \times B^{\mathbb N}\times C^{\mathbb N}\\\cong A^{\mathbb N}\times B^{\mathbb N}\times C^{\mathbb N}\cong B\times (A^{\mathbb N} \times B^{\mathbb N}\times C^{\mathbb N}).$$ Note that I use repeatedly that $X\times X^{\mathbb N}\cong X^{\mathbb N}$.