The latent reservoir for HIV-1 in resting memory CD4+ T cells is the major barrier to curing HIV-1 infection. Studies of HIV-1 latency have focused on regulation of viral gene expression in cells in which latent infection is established. However, it remains unclear how infection initially becomes latent. Here we described a unique set of properties of CD4+ T cells undergoing effector-to-memory transition including temporary upregulation of CCR5 expression and rapid downregulation of cellular gene transcription. These cells allowed completion of steps in the HIV-1 life cycle through integration but suppressed HIV-1 gene transcription, thus allowing the establishment of latency. CD4+ T cells in this stage were substantially more permissive for HIV-1 latent infection than other CD4+ T cells. Establishment of latent HIV-1 infection in CD4+ T could be inhibited by viral-specific CD8+ T cells, a result with implications for elimination of latent HIV-1 infection by T cell-based vaccines. The latent reservoir for HIV is a barrier to cure, but it is unclear why HIV establishes latency given its ability to evade immune responses through evolution. Shan et al. show that latency is an unfortunate consequence of infection of CD4+ T cells within a narrow time window after activation.