Generative artificial intelligence (GenAI) is increasingly used in higher education, but its relationship with students’ capacity to act intentionally in learning remains underexplored. This study examined whether learning-oriented GenAI use was associated with student agency, and whether this association was mediated by self-directed learning and moderated by assessment climate. A cross-sectional survey of 742 undergraduates from six Chinese universities was analysed using confirmatory factor analysis and structural equation modelling. The four focal constructs showed adequate empirical distinctiveness. Learning-oriented GenAI use was positively related to both self-directed learning and student agency, and self-directed learning partially mediated this relationship. Assessment climate also moderated the link between GenAI use and agency: the association was stronger when students perceived assessment as supporting feedback, reflection and improvement. These findings suggest that GenAI is more likely to support student agency when students use it for understanding and self-regulated learning, and when assessment environments encourage constructive engagement rather than simple task completion.