Question: in which part of the electromagnetic spectrum does a photon have the greatest energy?
Answer: Gamma rays, a form of nuclear and cosmic EM radiation, can have the highest frequencies and, hence, the highest photon energies in the EM spectrum.