Let $\alpha_1$ and $\beta_1$ be loops on $(T^2)_1$ which generate $\pi_1((T^2)_1)$ and $\alpha_2$ and $\beta_2$ be the corresponding loops in $(T^2)_2$. The space $X$ is what we get when we glue the tori together alone $\alpha_1$ and $\alpha_2$.
Let $U_1\subset X$ be a small open neighbourhood of $(T^2)_1$ in $X$ and similarly let $U_2\subset X$ be a small open neighbourhood of $(T^2)_2$ in $X$. The intersection $U_1\cap U_2$ is a small open neighbourhood of $\alpha_1=\alpha_2$ and so in particular has fundamental group which is generated by these elements. We can conclude from Van-Kampen's theorem that $$\pi_1(X)=((\mathbb{Z}^2\ast\mathbb{Z}^2)_{\langle \alpha_1,\beta_1,\alpha_2,\beta_2 \rangle})/\langle\alpha_1=\alpha_2\rangle$$
Honestly, the much quicker way to calculate this fundamental group, without worrying about Van-Kampen's theorem, is to see that $X$ is homeomorphic to the space $(S^1\vee S^1)\times S^1$, the product of a circle with a wedge of two circles (figure eight space). We can then use the fact that $\pi_1(A\vee B)\cong \pi_1(A)\ast \pi_1(B)$ and $\pi_1(A\times B)\cong \pi_1(A)\times\pi_1(B)$ to get $\pi_1(X)\cong (\mathbb{Z}\ast\mathbb{Z})\times\mathbb{Z}$ - here the three generaters from left to right are $\beta_1,\beta_2,\alpha_1(=\alpha_2)$.