Light illumination was observed to be able to change the charge status of surface states in an AlGaN/GaN heterostructure and vary the conductivity of the two-dimensional electron gas channel. The effects of several parameters, including sample temperature, intensity of the ultraviolet (UV) light, wavelength, and intensity of the laser light, were investigated and mathematically analyzed. A physical model that described the dynamics of excess carriers to different light illumination was proposed. Excess carriers created by UV light are able to reach the surface states after overcoming the valence and conduction band discontinuities by absorbing thermal energy and energy of the subsequently incident photon, respectively. Understanding the effect of the ambient illumination can help to achieve a higher sensitivity for an AlGaN/GaN sensor and discover new applications in the future.