Formative assessment can be a powerful approach in influencing student mathematical motivation, and the emergence of generative artificial intelligence (AI) offers more possibilities to do so, especially when using feedback for formative assessment. Nonetheless, the literature review of this study found limited development and research on investigating the impact of using generative AI-based formative feedback on student mathematical motivation. Therefore, this study examined the impact of implementing Class Optimization Master, generative AI-based formative feedback software, in promoting student mathematical motivation. The study employed a case study on fourth-grade students in a primary school in China. Semi-structured interviews with 21 students and two teachers were conducted face-to-face. Then, the interview data were analyzed by thematic analysis based on the three-dimensions theoretical framework of Mathematical Motivation Scale: Beliefs, Engagement, and Attitude. This study found that the use of AI-generated formative feedback enhanced student mathematical motivation by (1) boosting confidence, promoting socio-emotional interaction, and raising the importance of mathematics; (2) rewarding and inspiring a preference for mathematics; and (3) stimulating interest and mental-physical effort. These results provide insights for educators to design how to make use of AI-generated formative feedback to promote mathematical learning. It nonetheless calls for more research using quantitative methods and from different perspectives on this topic.