Consider $X$ is a path connected space. Choose an element $[a]$ from it's fundamental group $\pi_{1}(X)$, and then choose a loop $a\in[a]$. This $a$ can be taken as a map from $S^{1}$ to $X$. Now we attach a 2-cell to $X$ via $a$ to obtain space $Y$. The statement is $Y$ is simply connected.
My counter example: Consider a disk removing two point in the interior, let $a$ be a loop enclosed one point. Then the space $Y$ is homotopy equivalent to a disk removing one point, which is not simply connected.
Does the counter example works? If not, what's wrong?
What you are doing here is known as the method of killing homotopy groups. See here. Let us see what is going on in dimension $1$ if we take an element $g \in \pi_1(X,x_0)$, represent it by a map $\gamma : S^1 \to X$ and attach a $2$-cell to $X$ via $\gamma$. If $i : X \to X' = X \cup_\gamma D^2$ denotes inclusion, then $$i_* : \pi_1(X,x_0) \to \pi_1(X', x_0) $$ is an epimorphism whose kernel is the normal subgroup $N(g)$ of $\pi_1(X,x_0)$ generated by $g$. This shows that in general $X'$ is not simply connected. For example, if $X = S^1$ and $g$ is the equivalence class of a loop of degree $n$, then $\pi_1(X') \approx \mathbb Z_{\lvert n \rvert}$.
The above result can be easily proved by the Seifert - van Kampen theorem.
We have $X' = A \cup B$ with $A = X' \setminus \{\text{point in the interior of the attached } 2\text{-cell}\}$, $B =$ interior of the attached $2$-cell. But $B$ is contractible, $X$ is a strong deformation retract of $A$ and $A \cap B \approx S^1 \times (0,1) \simeq S^1$. We get $$\pi_1(X') \approx (\pi_1(A) * \pi_1(B)) / N$$ where $N$ is the normal subgroup generated by all words of the form $i_A(g)i_B(g)^{-1}$ with $g \in \pi_1(A \cap B)$ and $i_A: \pi_1(A \cap B) \to \pi_1(A)$ and $i_B: \pi_1(A \cap B) \to \pi_1(B)$ induced by the inclusions $\iota_A: A \cap B \to A, \iota_B: A \cap B \to B$. But $\pi_1(B) = 0$ and thus all $i_B(g)^{-1} = 0$. We conclude that $$\pi_1(X') \approx \pi_1(A)/H ,$$ where $H$ is the (normal) subgroup generated by all $i_A(h)$ with $h \in \pi_1(A \cap B)$. But now we have a commutative diagram $\require{AMScd}$ \begin{CD} \pi_1(A) @>{r_*}>> \pi_1(X) \\ @A{i_A}AA @A{\gamma_*}AA \\ \pi_1(A \cap B) @>{\rho_*}>> \pi_1(S^1) \end{CD} with retraction $r : A \to X$ and the obvious $\rho : A \cap B \to S^1$. Both $r_*$ and $\rho_*$ are isomorphisms, thus we see that $\pi_1(A)/H \approx \pi_1(X)/ N(g)$.