The energy released in both fusion and fission reactions comes from excess nuclear binding energy which is left over after the nuclei have fused or fissioned.
Fusion reactions occur in lighter nuclei, while fission reactions occur in heavy nuclei. To take fission reactions first, a heavy nucleus like U-235 is bombarded typically with neutrons, which can penetrate to the nucleus without being affected by the electrons surrounding the nucleus, due to the neutral charge of the neutron. When a neutron strikes the uranium nucleus, it sets up an unstable situation, and the nucleus splits into two roughly equal parts, emitting more single neutrons in the process. As long as at least 2 additional neutrons are produced during every fission, a 'chain-reaction' phenomenon is established, where fission of a critical mass of uranium can proceed until either all of the uranium splits, or the critical mass dissipates due to the high temperatures which result.
http://en.wikipedia.org/wiki/Nuclear_fission
Because there is less binding energy for the fission products (including the neutrons) than for the original uranium nucleus, the difference in binding energy is emitted as gamma rays and in the form of kinetic energy, as the fission product nuclei physically fly away from the spot where the nucleus was originally struck by the neutron.
The fusion reaction works in reverse: two lighter nuclei, like isotopes of hydrogen H-2 and H-3, join together to make a heavier nuclei, like He-3 or He-4. The heavier nuclei take less binding energy than the lighter nuclei, so there is a release of this excess energy into the environment.
http://en.wikipedia.org/wiki/Nuclear_fusion
Typically, fusion reactions occur only when certain conditions of temperature or density are achieved in the original material. Once those conditions no longer exist, the fusion reactions stop. In order to achieve these conditions for fusion on Earth in a nuclear weapon, first a fission bomb is detonated, which produces the high temperature and which compresses the hydrogen fuel to the density required to initiate fusion. These conditions exist for only a fraction of a second, during which the fusion reactions take place to spectacular effect.