Organic fertilizer substitution technology is an effective measure to solve the excessive application of chemical fertilizers in agricultural production. A pot experiment was set up with 5 treatments: no fertilizer (CK) and organic fertilizer substituting 0% (CF), 8% (OF8), 16% (OF16), and 24% (OF24) of chemical N fertilizer to analyze their effects on maize yield, soil organic carbon (SOC) and its fractions, carbon pool management index (CPMI), nutrients and heavy metals to provide a scientific basis for safe fertilizer application to maize. This study found that OF8, OF16, and OF24 all increased the content and proportion of SOC and labile organic C (LOC) fractions, CPMI, most of the middle and trace elements, and heavy metals content and their pollution indices in soil and grain compared to CF. Grain was more vulnerable to pollution compared to soil. There was a strong positive correlation between the content of middle and trace elements, and heavy metal, SOC and its fractions (except LLOC), and organic fertilizer substitution ratio, all with no significant correlation with yield. OF8 and OF16 promoted maize growth with a significant increase yield of 35.65% and 30.28% (P <0.05), respectively. A comprehensive analysis determined the optimum substitution ratio of 8% (OF8), which can reduce chemical fertilizer and increase yield, improve soil fertility, low heavy metal pollution risk, is beneficial to promote sustainable agricultural development.