In this paper, based on the excellent light trapping performance of the nanostructure, the structure of the electron emission layer of the ultraviolet detector is optimized. In this paper, simulation models of gallium nitride (GaN) nanohole arrays and nanorod arrays are designed by COMSOL Multiphysics software, which is based on the finite element method (FEM). In order to optimize the geometric parameters of GaN nanohole and nanorod arrays, and understand the influence of polarized light on them, the light absorption performance in the ultraviolet (UV) band has been fully analyzed. We found that when the lattice constant ranges from 200 to 500 nm, the GaN nanohole array and the GaN nanorod array have extreme absorptivity. And when the incident light has an inclination of 20°, the light trapping performance of the nanohole array can be further improved. GaN nanostructures with high light trapping capabilities will help improve the photoelectric emission efficiency of GaN photocathode and provide design reference for UV detectors with excellent performance.