A chemical bond is a bound state, which has negative potential energy. Essentially, when a bond is formed, you lose potential energy in the form of heat.
An analogy would be you and the Earth (i.e. gravity). On the Earth's surface, you have no potential energy but if you were elevated (e.g. in a plane or further), then you have potential energy (and not/weakly bound), which is released and turned into kinetic energy as you fall (that's analogous to forming of the chemical bond).
The same applies to free atoms. When free atoms meet and form a chemical bond, that's equivalent to you falling from a plane towards the Earth. In both cases, you're moving closer together and potential energy is converted to heat/kinetic energy.