The correlation of imbalanced gut microbiota with the onset and progression of colorectal cancer (CRC) has become clear. This work investigates the effect of metformin on gut microbiota and genesis of CRC in mice. Human fecal samples were collected from healthy control (HC) donors and CRC patients. Compared to HC donors, CRC patients had reduced abundance of gut microbiota; however, they had increased abundance of detrimental Bacteroidetes. Mice were injected with azomethane (AOM) to induce colorectal tumorigenesis models. Treatment of CRC patients-sourced fecal microbiota promoted tumorigenesis, and it increased the expression of Ki67, β-catenin, COX-2, and Cyclin D1 in mouse colon tissues. Further treatment of metformin blocked the colorectal tumorigenesis in mice. Fecal microbiota from the metformin-treated mice was collected, which showed decreased Bacteroidetes abundance and suppressed AOM-induced colorectal tumorigenesis in mice as well. Moreover, the metformin- modified microbiota promoted the M1 macrophage-related markers IL-6 and iNOS but suppressed the M2 macrophage-related markers IL-4R and Arg1 in mouse colon tissues. In conclusion, this study suggests that metformin-mediated gut microbiota alteration suppresses macrophage M2 polarization to block colorectal tumorigenesis.