Cooper pairs form due to an attractive interaction between electrons in a superconductor, mediated by phonons, which are quanta of lattice vibrations. Despite the repulsive force between negatively charged electrons, at sufficiently low temperatures, the attractive interaction dominates, causing electrons to pair up.