Nuclear fission and nuclear fusion release large amounts of energy because of changes in the binding energy of atomic nuclei. In nuclear fusion, light atomic nuclei (such as hydrogen isotopes) combine to form a heavier nucleus (such as helium). This process releases energy because the binding energy per nucleon increases up to elements around iron and nickel. The resultant nucleus is more tightly bound than the original nuclei, so excess mass is converted to energy according to mass-energy equivalence. It is the strong nuclear force overcoming electrostatic repulsion at very close distances that allows fusion to release large energy.
In nuclear fission, a heavy unstable nucleus (like uranium-235) splits into two smaller nuclei and additional neutrons. The products are more tightly bound (higher binding energy per nucleon) than the original heavy nucleus, so the total mass decreases and the lost mass is released as kinetic energy and gamma radiation. The reduction in electrostatic repulsion in the smaller daughter nuclei also contributes to this energy release. This energy comes from the change in nuclear binding energy and mass defect.
Thus, both processes release energy due to the differences in nuclear binding energies before and after the reaction, with the mass defect being converted into energy by Einstein's equation E=mc2E=mc^2E=mc2. Fusion releases energy by combining light nuclei into a more stable nucleus, and fission releases energy by splitting a heavy nucleus into smaller, more stable nuclei.