In recent years, AI technologies have been developed to promote students' self‐regulated learning (SRL) and proactive learning in digital learning environments. This paper discusses a comparative study between generative AI‐based (SRLbot) and rule‐based AI chatbots (Nemobot) in a 3‐week science learning experience with 74 Secondary 4 students in Hong Kong. The experimental group used SRLbot to maintain a regular study habit and facilitate their SRL, while the control group utilized rule‐based AI chatbots. Results showed that SRLbot effectively enhanced students' science knowledge, behavioural engagement and motivation. Quantile regression analysis indicated that the number of interactions significantly predicted variations in SRL. Students appreciated the personalized recommendations and flexibility of SRLbot, which adjusted responses based on their specific learning and SRL scenarios. The ChatGPT‐enhanced instructional design reduced learning anxiety and promoted learning performance, motivation and sustained learning habits. Students' feedback on learning challenges, psychological support and self‐regulation behaviours provided insights into their progress and experience with this technology. SRLbot's adaptability and personalized approach distinguished it from rule‐based chatbots. The findings offer valuable evidence for AI developers and educators to consider generative AI settings and chatbot design, facilitating greater success in online science learning. Practitioner notes What is already known about this topic AI technologies have been used to support student self‐regulated learning (SRL) across subjects. SRL has been identified as an important aspect of student learning that can be developed through technological support. Generative AI technologies like ChatGPT have shown potential for enhancing student learning by providing personalized guidance and feedback. What this paper adds This paper reports on a case study that specifically examines the effectiveness of ChatGPT in promoting SRL among secondary students. The study provides evidence that ChatGPT can enhance students' science knowledge, motivation and SRL compared to a rule‐based AI chatbot. The study offers insights into how ChatGPT can be used as a tool to facilitate SRL and promote sustained learning habits. Implications for practice and/or policy The findings of this study suggest that educators should consider the potential of ChatGPT and other generative AI technologies to support student learning and SRL. Educators and students should be aware of the limitations of AI technologies and ensure that they are used appropriately to generate desired responses. It is also important to equip teachers and students with AI competencies to enable them to use AI for learning and teaching.