Programming education can play an important role in cultivating students' higher-order thinking ability and enhancing the competitiveness of an intelligent society. However, a series of problems still exist: the lack of high-quality programming teachers, the low degree of personalization, and the insufficient learning interaction. This study constructs a novel programming learning model based on AI-generated content technology under the guidance of constructivism learning theory and cognitive load theory. The model divides programming learning into the process of learning program development, personalized context creation, learning chain of thought execution and practice exercises, and real-time interaction throughout the process. On this basis, the platform alleviates the shortage of teachers through intelligent programming assistants, realizes personalized programming learning through learning analytics and customized learning settings, as well as using real-time interaction throughout the whole process to change the status quo of insufficient interaction. Compared with traditional programming learning and practice methods, AIGC-based programming learning platforms can provide a more personalized learning experience and more timely learning interactions, which can effectively enhance learners' interest and learning quality.