Among ∼5,000,000 fungal species, C. albicans is exceptional in its lifelong association with humans, either within the gastrointestinal microbiome or as an invasive pathogen. Opportunistic infections are generally ascribed to defective host immunity but may require specific microbial programs. Here we report that exposure of C. albicans to the mammalian gut triggers a developmental switch, driven by the Wor1 transcription factor, to a commensal cell type. Wor1 expression was previously observed only in rare genetic backgrounds, where it controls a white-opaque switch in mating. We show that passage of wild-type cells through the mouse gastrointestinal tract triggers WOR1 expression and a novel phenotypic switch. The resulting GUT (gastrointestinally induced transition) cells differ morphologically and functionally from previously defined cell types, including opaque cells, and express a transcriptome that is optimized for the digestive tract. The white-GUT switch illuminates how a microorganism can use distinct genetic programs to transition between commensalism and invasive pathogenesis.