A set of carbonatite dykes intruding into Paleoproterozoic granites are exposed in Fengzhen area, where the Trans-North China Orogen joined with the Khondalite Belt. Some pyroxenites and syenites were also developed close to the carbonatite dykes. But the genetic relationship between these rocks and carbonatite dykes has not been solved. The pyroxenites show low SiO2 (40–49 wt%), high CaO (>20 wt%), and are enriched in light rare earth elements, strongly depleted in high field strength elements (Nb, Ta, Zr, Hf), similar to the characteristics of carbonatite dykes. The zircon UPb ages of pyroxenites and syenites are 1789 ± 13 Ma and 1793 ± 14 Ma, respectively. The wall-rock granite yields a metamorphic age of 1839 ± 19 Ma, which is close to the magmatic age of the pyroxenites and syenites. The whole-rock εNd(t) values (−4.4 to −5.1) and εHf(t) values (−3.8 to −6.9) of the pyroxenites are both negative, which are similar to those of the syenites (−3.7 to −4.7 and − 4.1 to −5.3) but slightly lower than those of wall-rock granites (−3.5 and 1.9). The δ18O values of clinopyroxene in the pyroxenites fall in a range of 6.6–11.3‰, which are much higher than the mantle value. The calcite of the carbonatites and pyroxenites gave overlapped δ18O value ranges of 11.8–14.8‰ and 9.3–15.0‰, respectively. They are also higher than typical primary carbonatites. These lines of geochemical evidence indicate that the pyroxenites are not mantle xenolith or derived directly from mafic magma, but closely related to the carbonatite dykes and the wall-rock granites. Since the Ba/La and Ba/Mn ratios of the syenites are much higher than those of the carbonatite, an immiscibility origin is excluded. Mineral chemistry of clinopyroxene, olivine, calcite and phlogopite from the carbonatite, pyroxenite and syenite all suggest they are formed by different degrees of reaction between carbonatite magma and felsic crustal rocks. Modeling shows that the Nd isotope compositions and trace element compositions of the pyroxenites and syenites fall on the mixing trends between the carbonatite dykes and wall-rock granites. These results demonstrate that the pyroxenites and syenites in the Fengzhen area were formed when carbonatite magma intruded and reacted with felsic crustal rocks. This provides a canonical case for the formation of pyroxenite and syenite by carbonatite magma-wall rock reaction.