Wilking's connectivity theorem says, $X$ is a positively curved manifold and $Y$ is a totally geodesic submanifold of codimension $k$,then $Y$ is $n2k+1$ connected in $X$.Then follow the theorem can we get that $XY$ has homology up to $2k2$?

This is a consequence of Poincaré duality applied to the open $n$manifold $XY$. In particular, we have $H^i_c(XY)\cong H_{ni}(XY)$ for all $i$, where $H^\ast_c$ denotes cohomology with compact supports. So it suffices to check that the compactly supported cohomology of $XY$ vanishes below degree $n2k+2$. There is a long exact sequence for compactly supported cohomology, which in this case looks like $$ \cdots \to H^i_c(XY)\to H^i_c(X)\to H^i_c(Y)\to H^{i+1}_c(XY)\to\cdots $$ and so the claim follows from the connectivity assumption on the inclusion map $Y\subseteq X$. This all works with integral or mod 2 coefficients, depending on the orientability of the spaces involved. Edit: The above argument works when $X$ and $Y$ are compact, which is the setting for Wilking's connectivity theorem mentioned by the OP (Acta Math. 191 (2003), no. 2, 259–297). In that case, compactly supported cohomology coincides with ordinary cohomology, and the map $H^i(X)\to H^i(Y)$ is an isomorphism for $i< n2k+1$ and a monomorphism for $i=n2k+1$ by naturality of the universal coefficient exact sequence and the five lemma. It is false in general that a map of manifolds $f\colon\thinspace Y\to X$ which is $r$connected induces an isomorphism $f^\ast\colon\thinspace H^i_c(X)\to H^i_c(Y)$ for $i< r$ and a monomorphism for $i=r$, because compactly supported cohomology is not homotopy invariant. Take $X=\mathbb{R}^n$ and $Y=\lbrace 0\rbrace$ for example. 

