The aim of this study was to analyze the life habits and personal factors associated with increased severe acute respiratory syndrome coronavirus 2 (SARS-CoV-2) risk in a university environment with in-person lectures during the coronavirus disease 2019 (COVID-19) pandemic. To our knowledge, there are no previous longitudinal studies that have analyzed associations of behavioral and personal factors with the risk of SARS-CoV-2 infection on an entire university population. A cohort study was conducted in the 3 campuses of the University of Navarra between August 24, 2020, and May 30, 2021, including 14,496 students and employees; the final sample included 10,959. Descriptive and multivariate-adjusted models were fitted using Cox regression. A total of 1,032 (9.4%) participants were diagnosed with COVID-19 (879 students and 153 employees), almost 50% living with their families. COVID-19 was associated with living in college or residence (hazard ratio (HR) = 1.96, 95% CI: 1.45, 2.64), motor transportation (HR = 1.35, 95% CI: 1.14, 1.61), South American origin (HR = 1.43, 95% CI: 1.20, 1.72), and belonging to Madrid's campus (HR = 3.11, 95% CI: 2.47, 3.92). International students, especially from Latin America, mostly lived in university apartments or shared flats and cohabited with 4-11 people. Living in a big city (Madrid), was a significant risk factor.