Recent experiments have demonstrated that in a dense monolayer of photo-switchable dye methyl-red molecules the relaxation of an initial birefringence follows a power-law decay, typical for glass-like dynamics. The slow relaxation can efficiently be controlled and accelerated by illuminating the monolayer with circularly polarized light, which induces trans-cis isomerization cycles. To elucidate the microscopic mechanism, we develop a two-dimensional molecular model in which the trans and cis isomers are represented by straight and bent needles, respectively. As in the experimental system, the needles are allowed to rotate and to form overlaps but they cannot translate. The out-ofequilibrium rotational dynamics of the needles is generated using kinetic Monte Carlo simulations. We demonstrate that, in a regime of high density and low temperature, the power-law relaxation can be traced to the formation of spatio-temporal correlations in the rotational dynamics, i.e., dynamic heterogeneity. We also show that the nearly isotropic cis isomers can prevent dynamic heterogeneity from forming in the monolayer and that the relaxation then becomes exponential. C 2016 AIP Publishing LLC. [http://dx