Introduction Virologic failure due to antiretroviral drug resistance is a threat to efforts to control the human immunodeficiency virus (HIV) epidemic. Understanding the factors that influence the genetic and clinical expression of drug resistance is fundamental for infection control. Methods A nested case-control study was conducted on a cohort of adult HIV patients between 2016 and 2022. The cases were defined as patients with a confirmed diagnosis of virologic failure due to drug resistance, as indicated by a viral genotype result. The control group consisted of patients who had not experienced virologic failure or undergone any documented changes to their antiretroviral treatment. The incidence of virologic failure over a defined period was calculated. The characteristics of each group were documented in frequency tables and measures of central tendency. To identify risk factors, multiple logistic regression models were employed, and post hoc tests were conducted. All calculations were performed with 95% confidence intervals, and p-values less than 0.05 were considered significant. Results The incidence of virologic failure over the seven-year study period was 9.2% (95% CI: 7.5-11.2%). Low CD4 T-lymphocyte count (≤200 cells/mm³) at diagnosis (adjOR 14.2, 95% CI: 3.1-64.5), history of opportunistic infections (adjOR 3.5, 95% CI: 1.9-6.4), and late enrollment into an HIV program after diagnosis (>1 year) (adjOR 9.2, 95% CI: 3.8-22.2) were identified as independent predictors of virologic failure. The drugs with the highest rates of resistance were nevirapine (84.6%), efavirenz (82.4%), emtricitabine (81.3%), lamivudine (81.3%), and atazanavir (6.6%). The most prevalent major mutations identified were K103N, M184V, and M46I/M. Approximately 50% of the secondary mutations were identified in protease regions. Conclusions The incidence of virologic failure was low in the study population. The identified risk characteristics allow for the prediction of the profile of patients susceptible to failure and for the early optimization of treatment regimens.