Energy of a fission nuclear bomb comes from the gravitational energy of the stars.
Protons and neutrons can coalesce into different kinds of bound states. We call these states atomic nuclei. The ones with the same number of protons are called isotopes, the ones with different number are nuclei of atoms of different kinds.
There are many possible different stable states (that is, stable nuclei), with different number of nucleons and different binding energies. However there are also some general tendencies for the specific binding energy per one nucleon (proton or neutron) in the nuclei. States of simple nuclei (like hidrogen or helium) have the lowest specific nucleon binding energy amongst all elements, but the higher is the atomic number, the higher the specific energy gets. However, for the very heavy nuclei the specific binding energy starts to drop again.
Here is a graph that sums it up:
It means that when nucleons are in the medium-atomic number nuclei, they have the highest possible binding energy. When they sit in very light elements (hidrogen) or very heavy ones (uranium), they have weaker binding. Thus, one can say that for the low "every-day" temperatures, the very heavy elements (like the very light ones) are quasistable in a sense.
Fission bomb effectively "lets" the very heavy atomic nuclei (plutonium, or uranium) to resettle to the atoms with lower number of nucleons, that is, with higher bound energies. The released binding energy difference makes the notorious effect. In terms of the graph cited above, it corresponds to nucleons moving from the right end closer to the peak.
Yet this is not the only way to let nucleons switch to the higher binding energy state than the initial one. We can "resettle" very light elements (like hydrogen) and let nucleons move to the peak from the left. That would be fusion.
Heavy nucleons emerge in the stars. Here the gravitational energy is high enough to let the nucleons "unite" into whatever nuclei they like. Stars usually are formed from the very light elements and the nucleons inside, again, tend to get to the states with lower energies, and form more "medium-number" nuclei. The energy difference powers stars and we see the light emission, high temperatures and all other fun effects.
However, sometimes the temperatures in the stars are so high, that nucleons form the very heavy nuclei from the medium-number nuclei. even though there is no immediate "energy" benefit.
These heavy elements then disseminate everywhere with the death of the star. This stored star energy can then be released in the fission bomb.