Theorem. Let $X$ be the union of two path-connected open sets $A$ and $B$ and assume that $A\cap B\neq \emptyset$ is simply-connected. Let $x_0$ be a point in $A\cap B$ and all fundamental groups will be written with respect to this base point. Let $\Phi:\pi_1(A)\sqcup \pi_1(B)\to \pi_1(X)$ be the natural homomorphism induced from the maps $\pi_1(A), \pi_1(B)\to \pi_1(X)$ (Here '$\sqcup$' denotes the free product). Then $\Phi$ is and isomorphism.
(The above theorem is given in more general form in Hatcher's Algebraic Topology, but for me the above special case suffices.)
I can see that $\Phi$ is surjective. So we need to address the injectivity of $\Phi$.
Write $G=\pi_1(A)\sqcup \pi_1(B)$. Suppose $\gamma$ is a loop in $A$ based at $x_0$. Think of $[\gamma]$ as member of $G$. Assume that $\Phi([\gamma])$ has the trivial homotopy class in $X$. In order for $\Phi$ to be injective, it is necessary that $[\gamma]$ be the identity element of $G$.
My question is whether or not the following statement is correct:
Statement. $[\gamma]$ is the identity element of $G$ if and only if $\gamma$ has trivial homotopy class in $\pi_1(A)$.
Please check my last statement. For if the above is wrong then it would mean I have to go back to free products.)
If I am understanding you correctly, you are asking whether the canonical inclusion map $\pi_1(A)\to \pi_1(A)\sqcup\pi_1(B)$ is injective. This is true, and follows from the concrete description of elements of the free product as reduced words. Explicitly, an element of $\pi_1(A)\sqcup\pi_1(B)$ is a finite sequence $(a_1,a_2,\dots, a_n)$ where the $a_i$ alternate between being non-identity elements of $\pi_1(A)$ and non-identity elements of $\pi_1(B)$. The inclusion map $\pi_1(A)\to\pi_1(A)\sqcup\pi_1(B)$ then sends $a\in\pi_1(A)$ to the sequence of length $1$ consisting only of $a$ if $a$ is not the identity, and sends the identity to the sequence of length $0$ (which is the identity of $\pi_1(A)\sqcup\pi_1(B)$). This map is obviously injective.