Why does gamma radiation actually occur
This process can leave the nucleus with excess energy, which is emitted in the form of a gamma-ray. Gamma decay occurs when there is too much energy in the nucleus of an atom, causing it to emit a gamma-ray without changing its charge or mass composition.
Like the electrons, the nucleons also exist in various energy states. Now, as these energy states are predominantly because of strong nuclear force, in contrast to Coulomb force for electrons, they are very large and so are the difference between the energy states (of the order of few MeVs). Hence the usual methods of heating etc. cannot excite a nucleus. Now, gamma rays are emitted when a nucleus transitions from higher energy state to ground state. The energy the nucleus loses in the process is very high, and hence, the energy of the gamma rays emitted is very high.