Microglia arise from embryonic yolk sac and colonize the brain parenchyma, followed by the maturation of microglia-specific gene expression. Single-cell transcriptional analysis has revealed that microglia are transcriptionally heterogeneous. However, the environmental factors that induce microglial heterogeneity are largely unknown. Here we found that developmental intracerebral hemorrhage induces microglial heterogeneity. In neonatal mice, we found that a portion of microglia phagocytose the red blood cells (RBCs) and expressed Hmox1, which encodes Heme Oxygenase 1, significantly higher than non-RBC-phagocytic microglia. To examine the effect of RBC phagocytosis on the transcriptional property of microglia, we labeled Hmox1-expressing microglia with red fluorescent protein by developing a transgenic mouse line, finding that microglia that underwent RBC phagocytosis expressed genes typical for yolk sac microglia in the second postnatal week. Thus, this study reveals that neonatal environmental factors induce microglial heterogeneity.