It has to do with stable shells.
Neon has an atomic number of 10. It has it's first two shells filled 2 and 8 and hence is stable. It is called a Noble gas and doesn't want to share or give/take electrons. For this reason it stays alone - monoatomic.
Chlorine has an atomic number of 17. It has its first two shells filed and 7 of 8 electrons in the third: 2 8 7. It wants to get or share one more electron. Chlorine therefore forms a diatomic molecule so that each Chlorine atom can share one electron with the other, in effect creating stable outer shells.