C57BL/6 mice are one of the most widely used inbred strains in biomedical research. Early separation of the breeding colony has led to the development of several sub-strains. Colony separation led to genetic variation development driving numerous phenotypic discrepancies. The reported phenotypic behavior differences between the sub-strains were, however; not consistent in the literature, suggesting the involvement of factors other than host genes. Here, we characterized the cognitive and affective behavior of C57BL/6J and C57BL/6N mice in correlation with the immune cell profile in the brain. Furthermore, faecal microbiota transfer and mice co-housing techniques were used to dissect microbial and environmental factors’ contribution, respectively, to cognitive and affective behavior patterns. We first noted a unique profile of locomotor activity, immobility pattern, and spatial and non-spatial learning and memory abilities between the two sub-strains. The phenotypic behavior profile was associated with a distinct difference in the dynamics of type 2 cytokines in the meninges and brain parenchyma. Analysing the contribution of microbiome and environmental factors to the noted behavioral profile, our data indicated that while immobility pattern was genetically driven, locomotor activity and cognitive abilities were highly sensitive to alterations in the gut microbiome and environmental factors. Changes in the phenotypic behavior in response to these factors were associated with changes in immune cell profile. While microglia were highly sensitive to alteration in gut microbiome, immune cells in meninges were more resilient. Collectively, our findings demonstrated a direct impact of environmental conditions on gut microbiota which subsequently impacts the brain immune cell profile that could modulate cognitive and affective behavior. Our data further highlight the importance of characterizing the laboratory available strain/sub-strain to select the most appropriate one that fits best the study purpose.