Difference between "generating set" and free product?

Since none of these points are in the answers above, although they answer your question, I'd like to add some comments. I won't add a new counterexample, since the other answers already cover that, just add a more abstract viewpoint.

First of all, there is an essential difference between $\langle G,H\rangle$ and $G*H$, namely $\langle G,H\rangle$ presupposes that $G$ and $H$ are embedded in some larger group, which I'll call $K$, whereas the free product does not. The group operation on $K$ may impose relations on $G$ and $H$ that are not present in the free product (which has no relations between the elements of $G$ and the elements of $H$).

What this means concretely is that if we consider the homomorphism $\phi:G*H\to K$ given by the universal property of the free product, its image is $\langle G,H\rangle$, and its kernel tells us whether or not $G*H$ and $\langle G,H\rangle$ are isomorphic (technically this only tells us if they're naturally isomorphic, but let's ignore that tangent).

The elements of the kernel of $\phi$ will be the relations between elements of $G$ and $H$ imposed by the group operation on $K$.

If we look at giannispapav/Dietrich Burde's counterexamples, if we let $K=G=H=F_n$ be free groups, then $\langle G,H\rangle =K$, and $G*H=F_{2n}$, and the map sends the word $g_1h_1g_2h_2\cdots g_nh_n$ in $G*H$ to the result of evaluating this product in $K$.

The relations are $g_Gg^{-1}_H=1$, where $g_G$ is an element $g$ of $K$ regarded as an element of $G$, $g^{-1}_H$ is the inverse of the same element $g$ of $K$ regarded as an element of $H$.


In general, yes there is a difference between these two groups. For instance, consider the subgroups $2\mathbf Z$ and $3\mathbf Z$. Then we have $\langle 2\mathbf Z , 3\mathbf Z\rangle = \mathbf Z$, but $2\mathbf Z\ast3\mathbf Z = 2\mathbf Z\ast\langle 3\rangle\cong\mathbf Z\ast\mathbf Z$ is not an abelian group, since we do not impose any commutation relations between elements of (the isomorphic copy of) $2\mathbf Z$ and the elements of (the isomorphic copy of) $3\mathbf Z$.


As @Dietrich Burde suggests you can take $H=G=$(any free group $F_n,n\ge1$) and then $\langle G,H\rangle=H=G$ and $H*G$ is not isomorphic to $H$