For a long time, it was thought that the CCR5-delta32 mutation, which confers resistance to pathogens that infect macrophages (CCR5 is a chemokine receptor), like HIV, increased in frequency in European populations after the Black Death of the mid-14th century, because only individuals with at least one mutant allele had a chance of surviving the Yersinia pestis epidemic (Y. pestis infects macrophages).
Studies on ancient DNA suggest that the mutation may actually stem back to the Bronze Age, and perhaps even back to the age of Vikings. It turns out that members of the poxvirus family, like smallpox, exploit chemokine receptors on cell surfaces for purposes of viral attachment and entry, and smallpox has been a human problem for thousands of years, unlike HIV, which only emerged within the past century.
The mutation can confer “resistance” to HIV because while the virus can bind to its receptor (CD4) on macrophages, it cannot bind its coreceptor (CCR5) and thus cannot enter the cell to begin its replication cycle. Macrophage-tropic HIV is associated with increased virulence and disease progression because of the nature of the macrophage – as a phagocytic cell of the innate immune system, its role is to pass through the circulation (in its undifferentiated monocytic form) and tissue (as a differentiated macrophage) and engulf and digest things like pathogens and dead cells.
For more, see Galvani and Novembre, The evolutionary history of the CCR5-delta32 HIV-resistance mutation (2005).