You are still very early in your medical education. Pursue any research project that you will enjoy and will be comfortable talking about. If you are interested in HIV public health, by all means go for it! From what I understand, most residency programs are interested in applicants with an interest in research (basic science, translational, clinical, public health, etc.) or scholarly activity (case reports, review articles, clinical vignettes, etc.).
Also, if you're concerned that it won't match your residency, don't worry. HIV is a broad topic that you can tie into almost any specialty as it affects practically every organ system. Hypertension and diabetes are similar broad topics. It's not like you're conducting research on something so specific like the efficacy of sirolimus in the treatment of lymphangioleiomyomatosis. Likewise, it would be foolish for residency programs to expect you to commit to a specialty in your first year of medical school. No one expects you to know what you want to do in your first year of medical school. The pursuit of scholarly activity and the ability to show your interest in academic work via any research project should be a benefit even if you apply to a specialty that does not explicitly involve HIV. Any research is better than no research.
Public health is respected. In fact, on several of my interviews, they noted how they liked MD/MPH students and liked applicants who showed interest in research. I know a classmate who conducted research on epidemiology of ulcerative colitis and matched very well into ophthalmology. Another classmate conducted research on depression and matched into internal medicine. I conducted research on bariatric surgery in medical school, and no one questioned my interest in internal medicine on the interview trail.
Good luck with your research, and focus on conducting good, quality research. Hopefully you'll get a publication or a great project that will help you in your residency pursuits.