When a less electronegative atom comes in contact with more electronegative atom then more electronegative atom tends to attract the electrons from less electronegative atom.
Hence, a partial positive charge is developed on less electronegative atom and it has given an electron. On the other hand, a partial negative charge tends to develop on more electronegative atom due to gain of an electron.
Therefore, due to the presence of these opposite charges a strong force of attraction is exerted on both the atoms. As opposite charges attract each each other and like charges repel each other.