Nonpolar vs Polar Covelant Bonding
Look at each bond separately. In $CO_2$, in each $C=O$ bond, electrons are shifted towards oxygen atom as is has more pulling tendency(electron affinity). Now there is a formation of $\delta+$ charge on carbon and $\delta-$ on oxygen. This forms a dipole and you write it vectorially. In carbon dioxide, the vectors are equal and at $180$ degrees, so they cancel out and net dipole moment is 0, thus nonpolar molecule. Similarly, for the 2 $O-H$ bonds you get a net nonzero dipole moment, leading to a polar molecule.