Let's work with a concrete example.
You have tables of bond energies such as
http://www.cem.msu.edu/~reusch/OrgPage/bndenrgy.htm.
On that table, you can see that the bond energy of a C-C bond is given as 83 kcal/mol. What this means is that to break a mole of C-C bonds, producing two carbon radicals from each bond, you have to put in 83 kcal of energy. The reason for this is that having two carbons bonded to each other is more stable than having two carbon radicals. If you want to break a bond (move from a more stable to a less stable state), you have to put energy into the system. So when you form bonds, you're doing the opposite - moving from a less stable state to a more stable state, and energy is released.
However, this is sort of limited. Radicals are obviously an unstable kind of species, so it's hard to take this example and understand something like why burning gasoline results in releasing the potential energy stored in bonds within gasoline.
How was gasoline formed? Well, you had a bunch of molecules derived from dead dinosaurs which contained C and H that were relatively stable and low energy. You put a huge amount of pressure on them, and you formed hydrocarbon molecules like gasoline which are relatively less stable. Pressure was applied to molecules. This pressure did work, converting those molecules to higher-energy molecules. To go from lower-energy molecules (molecules which have bonds with relatively low bond energies) to higher-energy molecules (molecules which have bonds with relatively high bond energies), you have to supply outside energy -- in this case, that energy was supplied in the form of work done by pressure. Conservation of energy tells us that that energy put into the system by work has to go somewhere. It goes into the bonds as chemical potential energy.
The bonds in gasoline are still pretty stable. They won't just fall apart on their own under normal conditions. But when you supply the proper amount of energy, those bonds will break. And if the opportunity exists, those same bonds won't reform, but lower energy bonds will form instead. If you throw a match into gasoline in the presence of oxygen, you've provided the amount of energy needed to break the bonds of some of the gasoline molecules and the presence of oxygen allows for more stable bonds to form. When more stable bonds form, some of the potential energy that was stored in the chemical bonds of gasoline is released as heat.
If you look at where the heat energy released by burning gasoline came from, it came from the potential energy stored in the bonds within gasoline. Where did that potential energy come from? It's the energy which pressure supplied to a soup of dead dinosaurs a long time ago.
Hopefully this helps the thermo make a little more conceptual sense.