Step-by-step explanation:
When two atoms of different electronegativities are combined together then more electronegative atom attracts the valence electrons of less electronegative atom.
For example, in a NaCl molecule sodium has a partial positive charge and chlorine has a partial negative charge.
As a result, a partial negative charge will develop on the electronegative atom. And a partial positive charge will develop on the less electronegative atom.
Hence, polarity on a molecule develops.