Mycobacterium tuberculosis infection in humans triggers formation of granulomas, which are tightly organized immune cell aggregates that are the central structure of tuberculosis. Infected and uninfected macrophages interdigitate, assuming an altered, flattened appearance. Although pathologists have described these changes for over a century, the molecular and cellular programs underlying this transition are unclear. Here, using the zebrafish-Mycobacterium marinum model, we found that mycobacterial granuloma formation is accompanied by macrophage induction of canonical epithelial molecules and structures. We identified fundamental macrophage reprogramming events that parallel E-cadherin-dependent mesenchymal-epithelial transitions. Macrophage-specific disruption of E-cadherin function resulted in disordered granuloma formation, enhanced immune cell access, decreased bacterial burden, and increased host survival, suggesting that the granuloma can also serve a bacteria-protective role. Granuloma macrophages in humans with tuberculosis were similarly transformed. Thus, during mycobacterial infection, granuloma macrophages are broadly reprogrammed by epithelial modules, and this reprogramming alters the trajectory of infection and the associated immune response.