Mycobacteria spontaneously form surface-associated multicellular communities, called biofilms, which display resistance to a wide range of exogenous stresses. A causal relationship between biofilm formation and emergence of stress resistance is not known. Here, we report that activation of a nitrogen starvation response regulator, GlnR, during the development of Mycobacterium smegmatis biofilms leads to peroxide resistance. The resistance arises from induction of a GlnR-dependent peroxide resistance ( gpr) gene cluster comprising of 8 ORFs (MSMEG_0565-0572). Expression of gpr increases the NADPH to NADP ratio, suggesting that a reduced cytosolic environment of nitrogen-starved cells in biofilms contributes to peroxide resistance. Increased NADPH levels from gpr activity likely support the activity of enzymes involved in nitrogen assimilation, as suggested by a higher threshold of nitrogen supplement required by a gpr mutant to form biofilms. Together, our study uniquely interlinks a nutrient sensing mechanism with emergence of stress resistance during mycobacterial biofilm development. The gpr gene cluster is conserved in several mycobacteria that can cause nosocomial infections, offering a possible explanation for their resistance to peroxide-based sterilization of medical equipment.