Atoms independently are generally not stable, so they tend to exist in form of molecules. Stability is proportional to energy. High energy is attributed to less stability as compared to low stability.
Think of it as a classroom, where discipline (stability) of the class is dependent upon the energy of the students. Obviously, if the children are shouting (low energy) class' decorum is maintained, if they start howling (high energy) the class becomes unstable.
Now, molecules are formed when the bonds are made. Now the molecule formed is stable as opposed to independent atom, so by conservation of energy, the excess energy difference is liberated as exothermic heat, some work, etc.