This question already has an answer here:
If the electrons are relatively more stable when they are delocalized than when they are localized between two atoms, then why do we have bonds formed in the first place? Forming of bonds between two atoms means that electrons localized between the two atoms, if electrons tend to delocalize then why not all electrons (including the sigma bond electrons) are just delocalized? What is the driving force for delocalisation ? How does delocalisation the energy of the system?