Atoms form chemical bonds because they are seeking out stability. Atoms have free electrons known as valence electrons in their outermost orbital that create unbalanced charges and cause them to be reactive and unstable. The loss, addition or sharing of valence electrons is what causes atoms to bond together.
The Octet Rule is a principle in chemistry that states an atom is most stable when there are eight electrons occupying its outermost orbital. The type of bond an atom forms is relative to the behavior of their valence electrons and electronegativity values. The difference in electronegativity between atoms determines if they form a covalent bond or a ionic bond.
In an ionic bond, one atom donates its valence electrons to another atom. The electron donor becomes positively charged, and the electron receiver becomes negatively charged. These charged particles become attracted to each other and bond to become stable and neutralize their charges.
In a covalent bond, atoms share valence electrons. This allows the atoms to stabilize their inherent charges and become unreactive. Atoms that belong to the noble gas group of elements are generally unreactive and do not form chemical bonds because their valence electron shells are completely full and balanced.