Affective, behavioral, and cognitive engagements play crucial roles in how learners interact with and process written feedback on their language production. The present study examines the efficacy of peer feedback versus ChatGPT-generated feedback in an English as a Foreign Language (EFL) writing context. Participants (n = 169) were 1st-year undergraduate students at a teacher education university in China, enrolled in a mandatory writing class. The control group (n = 86) did not use ChatGPT, while the treatment group (n = 83) engaged with ChatGPT, leveraging carefully designed prompts to receive feedback on their writing. A survey instrument measuring affective, behavioral, and cognitive engagement was administered at both the start and conclusion of the semester. Results revealed that ChatGPT has potential to enhance specific aspects of student engagement, like affective and behavioral engagement, in EFL writing. Cognitive engagement, although slightly higher in the treatment group, did not differ significantly between the groups. The findings suggest that while AI-generated feedback can be integrated into EFL instruction, its impact on student engagement, particularly affective and behavioral, warrants careful consideration. We finally provided pedagogical implications based on the findings.