Chemical bonds are fairly easy to understand in terms of electron clouds.
We know that electron clouds around atomic nuclei come in layers, in which the innermost layer can have a maximum of 2 clouds, the next one out a maximum of 8, and farther out still another 8, etc.
The way this works when modelled with bouncing electrons is that electrons sometimes find ways to bounce off more than one atomic nucleus at a time.
In the case of hydrogen molecules, we have two protons held together with two electron clouds.
Since every hydrogen atom has 2 available slots in its inner layer, yet only 1 electron cloud, the most efficient configuration of two hydrogen atoms, is to have them share their respective electron clouds so as to make the most of the available space. The electrons bounce alternately off one and the other proton.
The 2 slots available for electrons to bounce are thus filled. Instead of each proton having only one electron bouncing off of them, both of them get two slots filled through mutual sharing of their single electron.
This yields a more efficient configuration, and energy is released in the process.
However, the hydrogen molecule is not particularly efficient. A more efficient configuration can be achieved by combining two hydrogen molecules with a carbon atom. The product of such a configuration yields methane.
Carbon has 4 empty slots in its second layer. When these slots get filled with electron clouds associated with the hydrogen molecules, an efficient configuration can be made in which all 8 outer slots of the carbon atom are filled in such a way that every hydrogen atom has its 2 slots occupied.
Note that efficiency is closely related to size. Two independent hydrogen atoms occupy more space than a single hydrogen molecule. Two hydrogen molecules and a carbon atom occupy more space than a single methane molecule.
The process of going from big and bloated to small and compact releases energy. The more compact a configuration, the less energy is left in it for further reactions.