Indeed it's in some way counterintuitive to say that the sun's energy is 'stored' in the coal bonds. Energy never comes from breaking bonds, it is released when forming bonds.
In the case at hand, the sun's energy is used to break carbon-oxygen bonds through photosynthesis. You get that energy back when carbon-oxygen bonds are formed by $\ce{C}$ and $\ce{O2}$ reacting to $\ce{CO2}$: that's where the energy of burning coal comes from.
The details can be quite delicate, since in most chemical reactions new bonds are formed at the same time as old bonds are broken. It then boils down to the relative energies of those bonds. In the case of burning coal, it costs less energy to break the $\ce{C-C}$ bonds of coal than what the formation of $\ce{C=O}$ bonds yield, so the reaction is exothermic.