With the rise of digital technology and the era of artificial intelligence is coming, how to develop students’ coding and computational thinking will be a crucial issue for future education and social development. Therefore, many advanced countries have begun to promote artificial intelligence education and coding courses from the primary school stage. However, primary school students also began to learn mathematics and technology, and it is not easy to promote artificial intelligence and coding. In this study, Microsoft’s Minecraft development platform is used as a teaching tool to enhance the learning interest of primary school students and reduce learning frustration through gameplay, visualization and easy-to-use interfaces, and to integrate student learning outcomes with practical project concepts into the design of teaching activities, the concept of coding and artificial intelligence education for primary school students can be effectively implemented.