Let $G$ be a group, and $X$ a space with $\pi_1 = G$. Then there is a map $f: X \to K(G,1)$ (unique up to homotopy) that is the identity on fundamental groups. Then $f$ is surjective on second homology, and the kernel of $f$ is precisely the homology classes representable by 2-spheres. This is because you can build a model of $K(G,1)$ out of $X$ - attach 3-cells and higher to kill off homotopy groups - and can extend the map $f$ over the new $K(G,1)$ so that it's still the identity on $\pi_1$. So the map $f$ can be considered as the inclusion into the model of $K(G,1)$ we built, and all we did was kill off the 2-spheres in second homology.
On the other hand, we can build a space $X$ with $\pi_1 X = G$, $H_2(X) = H_2(G)$, and $H_k(X) = 0$ for all $k \geq 3$. Just write down a 2-complex whose fundamental group is $G$ (for instance, a presentation complex), and attach 3-cells to kill off any homology classes represented by spheres. These don't contribute in third homology because their boundary is nonzero in the cellular homology chain complex. (You could possibly still have third homology, but not with $\Bbb Z$ coefficients.)