Although the gut is a central organ of Eumetazoans and is essential for organismal health, our understanding of its morphological and molecular determinants remains rudimentary. Here, we provide a comprehensive atlas of Drosophila adult midgut. Specifically, we uncover a fine-grained regional organization consisting of 14 subregions with distinct morphological, histological, and genetic properties. We also show that Drosophila intestinal regionalization is defined after adult emergence, remains stable throughout life, and reestablishes following acute tissue damage. Additionally, we show that this midgut compartmentalization is achieved through the interplay between pan-midgut and regionalized transcription factors, in concert with spatial activities of morphogens. Interestingly, disruption of the midgut compartmentalization leads to a loss of intestinal homeostasis characterized by an increase in stem cell proliferation and aberrant immune responses. Our integrative analysis of Drosophila midgut compartmentalization provides insights into the conserved mechanisms underlying intestinal regionalization in metazoans.