Endometritis in dairy cows is associated with pathogenic microorganisms, local inflammatory injuries, and uterine microecological disorders. Escherichia coli (E. coli) is the primary pathogen responsible for bovine endometritis onset; however, the underlying pathomechanisms remain unclear. In this study, we aimed to investigate E. coli-induced endometritis mechanisms in dairy cows using bovine bone marrow-derived macrophages and endometrial tissue. Following E. coli infection of macrophages, we observed a significant increase in the mRNA expression levels of innate immune recognition receptors, including toll-like receptor 2 (TLR2), toll-like receptor 4 (TLR4), and nucleotide-binding oligomerization domain-like receptor protein 3 (NLRP3), as well as prostaglandin D2 (PGD2)-related enzymes (cyclooxygenase-2 and hematopoietic prostaglandin D synthase). Furthermore, the secretion of PGD2, a major mediator of inflammation, was markedly upregulated. In E. coli-infected macrophages, TLR2, TLR4, and NLRP3 increased the secretion of inflammatory mediators, including PGD2, by activating mitogen-activated protein kinase (MAPK) and nuclear factor-κB (NF-κB). This lead to enhanced inflammatory response. During early E. coli infection, PGD2 inhibitors reduced the secretion of inflammatory mediators by modulating MAPK and NF-κB pathway activation and enhancing macrophage bacterial killing, thereby alleviating endometrial tissue damage in dairy cows. In contrast, in the later stages of infection, PGD2 inhibitors exacerbated the inflammatory response and impaired the killing capacity of macrophages, which lead to increased endometrial tissue damage. Therefore, our findings highlight that TLR2, TLR4, and NLRP3 are pivotal in regulating PGD2 secretion during E. coli-induced endometritis in dairy cows. PGD2 had a pro-inflammatory effect in the early stages of E. coli infection and anti-inflammatory effects in the later stages. These findings can help develop strategies benefiting endometritis treatment.