Resonant interaction between longitudinal-optic ͑LO͒ phonons and electrons bound on shallow donors in GaN is studied using magnetoluminescence of neutral-donor bound excitons ͑D 0 X͒. The experiments were performed on high-quality freestanding GaN material and heteroepitaxial GaN layers grown on sapphire. In addition to the principal recombination channel of D 0 X, in which donors are left in their ground states, two-electron satellites ͑TES͒ involving different excited donor excitations, as well as replicas of the principal D 0 X transition due to LO phonons, were observed for the oxygen and silicon donors. In order to separate transitions involving ground and excited D 0 X states, variable-temperature experiments were performed. The application of high magnetic fields allows tuning of the donor excitations into resonance with the LO phonon energy. This results in a strong enhancement of TES intensity and the appearance of several anticrossing processes in the vicinity of a LO phonon replica of the principal D 0 X transition. The observed behavior is explained in terms of a resonant interaction between LO phonons and donor-bound electrons ͑magnetopolaron effect͒. The experimental data are described using a phenomenological model that combines the theory of a hydrogen atom in a magnetic field with a model which includes the effects of nonparabolicity, nonresonant polaron corrections, and the resonant magnetopolaron effect on electrons bound to donors. It was found that the interaction in the resonant magnetopolaron regime is stronger for the oxygen than for the silicon donor.