The interaction of a high-frequency laser with plasma in the presence of an inhomogeneous external magnetic field has been studied here with the help of particle-in-cell simulations. It has been shown that the laser enters the plasma as an extraordinary wave (X-wave), where the electric field of the wave oscillates perpendicular to both the external magnetic field and propagation direction and as it travels through the plasma, its dispersion property changes due to the inhomogeneity of the externally applied magnetic field. Our study shows that the X-wave's electromagnetic energy is converted to an electrostatic mode as it encounters the upper-hybrid (UH) resonance layer. In the later stage of the evolution, this electrostatic wave breaks and converts its energy to electron kinetic energy. Our study reveals two additional processes involved in decay of the electrostatic mode at the UH resonance layer. We have shown that the energy of the electrostatic mode at the upper-hybrid resonance layer also converts to a low-frequency lower-hybrid mode and high-frequency electromagnetic harmonic radiations. The dependence of energy conversion processes on the gradient of the external magnetic field has also been studied and analyzed.