With the emergence of new classroom teaching modes such as STEM education, traditional classroom teaching and student cultivation are facing many new challenges, so this paper explores the use of knowledge mapping in teaching classrooms based on the STEM education perspective. The article first analyzes the basic theory of knowledge graphs and designs a knowledge graph architecture based on the relevant basic theory. It also proposes a personalized learning path generation and recommendation algorithm. Finally, 38 students majoring in educational technology were surveyed to test and explore the knowledge mapping approach proposed in this paper for STEM education. The results of the study indicate that the fifth and sixth groups, which utilized the personalized recommendation algorithm proposed in this paper, achieved the highest learning gains of 0.531 and 0.756, respectively.