Students face diverse pathways as they journey through undergraduate study. The analysis of student course records can untangle common patterns in course progression, and identify group trends in student outcomes. The current work examines the relationship between gender and undergraduate physics study, using course records from over nine thousand students who enrolled in physics at the University of Auckland, spanning a six year period. Physics students demographic and course records were analyzed to find out whether there were gender differences in subject selection, course performance, and confidence. Subsequent to taking a first year physics course, female students were more likely to take further courses in life science subjects, while male students were more likely to take physical science subjects. In first year courses, gender differences were not present among highly academically prepared students, for whom school type (single-sex or coeducational) was a better predictor of course outcome. However, of those students who were less academically prepared in their first year, male students tended to outperform female students. Female students were also more likely to take an introductory physics course before an advancing course, compared to male students, after controlling for academic preparation. Science capital, a concept related to Pierre Bourdieus notions of capital and habitus, was employed as an interpretive research framework. Habitus, the system of dispositions one uses to interpret the world, is largely influenced by the socio-cultural context in which an individual builds their identity. The following study explains how an interaction between science capital and an individuals habitus may lead to gender disparities in student outcomes in the field of physics.