Polarity of a molecule doesn't depend only on the presence of certain atom(s). It also depends on symmetry. For example, take the alkanes family [tex] C_{n}H_{2n+2} [/tex]. These molecules are generally nonpolar, because there is no net dipole moment. Now, dipole moment arises due to difference in the electronegativity of carbon and the other element. In organic chemistry, generally these atoms are Oxygen, Halogens, Nitrogen. Because of their high electronegativity, they cause a net dipole moment resulting in polarity.
[tex]H_3C-CH_3[/tex] is symmetrical and hence non-polar.
[tex]H_3C-O-CH_3[/tex] is asymmetrical and polar. It's structure is bent because of oxygen lone pairs.