This looks like a question that could be proved using the Seifert–Van Kampen theorem, but I am not sure if it is true.
Let $X=U \cup V$ be a topological space, where $U$, $V$ and $U\cap V$ are open, path-connected subspaces of $X$. Let $$i_U: \pi_1(U \cap V) \rightarrow \pi_1(U)\quad \text{and}\quad i_V: \pi_1(U \cap V) \rightarrow \pi_1(V)$$ be the inclusion maps. Suppose there exists a homotopically nontrivial element $\alpha \in \pi_1(U \cap V)$ such that $i_U(\alpha)$ is also nontrivial in $\pi_1(U)$. Is it true that if the inclusion map $i_V$ is injective, then $\alpha$ is nontrivial in $\pi_1(X)$?
Edit 1: I tried using the amalgamated product of fundamental groups of $U$ and $V$ to prove this result. Roughly speaking $\pi_1(X) = \langle \pi_1(U), \pi_1(V) : i_V(\alpha_i) = i_U(\alpha_i) \rangle$ where $\alpha_i$ are the generators of the intersection $\pi_1(U\cap V)$. By assumption none of the additional relations in the finite presentation of the fundamental group is of the form $\alpha = 1$. But I find it difficult to prove that the relations in the groups $\pi_1(U)$ and $\pi_1(V)$ cannot be used with the additional relations in the amalgamated product to yield $\alpha =1$.
Edit 2: Following the suggestion in the comments, the group-theoretic version of this question can be found here.