Carbonate deposits in the Ordovivian Majiagou Formation are significant source rocks for natural gas generation in the Ordos Basin, northwestern China. Previous studies mainly focused on the organic matter enrichment mechanism of shales rather than carbonate rocks. The biological sources and paleoenvironment of carbonate source rocks, and the main controlling factors of organic matter enrichment in the carbonate source rocks were studied in this paper in combination with evidence from biomarkers, microfossils and inorganic geochemistry analysis. The results show that four types of microfacies were identified in the Majiagou Formation, respectively as: mud flat microfacies, mud–dolomite flat microfacies, dolomite flat microfacies, and open marine microfacies. The biological sources of organic matter are chiefly planktonic algae, followed by bacteria. The mud flat and mud–dolomite flat contain a high abundance of terrigenous detrital inputs, as indicated by the high content of Al2O3, TiO2, Th, and Zr. The low Sr/Cu and high Rb/Sr values reveal warm and humid paleoclimate conditions in the mud flat and mud–dolomite flat, whereas the dolomite flat and open marine were likely formed in hot and arid paleoclimate conditions. The mud flat and mud–dolomite flat deposits were characterized by high paleoproductivity of the Majiagou Formation. Low Sr/Ba values were found in the mud flat samples, indicating fresh to brackish water condition, whereas samples of other facies have a relatively high degree of salinity. Based on Uauth, Moauth, Crauth, Coauth, δCe, and δEu values, the mud flat microfacies was formed in a suboxic and anoxic environment, whereas the mud–dolomite flat, dolomite flat and open marine microfacies were within dysoxic to oxic conditions. A model of organic matter enrichment in the Majiagou Formation is thus established. The level of terrigenous detrital inputs is the principal factor of organic matter enrichment in the Majiagou Formation, secondly are redox condition and then paleoproductivity. The mud flat and mud–dolomite flat microfacies show abundant terrestrial detrital inputs and nutrient elements, indicative of warm and humid climate that facilitated biotic productivity, including an abundance of planktonic algae (microfossils). The suboxic and anoxic environments promoted the preservation of organic matter, as evidenced by the relatively high TOC content. The mud flat as well as the mud–dolomite flat of the Majiagou Formation is prospecting for forming source rocks.