My understanding of the origin of the HIV epidemic was bad hunting practices in Africa in the early 20th century, with bites from animals infected with SIV that mutated into HIV in humans.
SIV in apes has been around for thousands of years, and yet countless different strains of HIV only occured in the 20th century. Urbanization in africa caused the widespread of HIV.
Is it possible that there were cases of HIV before this, and it just wasn't understood and not widespread?
Yes, it's quite possible. There appear to have been multiple transmissions from monkeys and apes to humans. HIV-1, which is responsible for most human infections, probably crossed from apes to humans 4 times, twice from chimpanzees and twice from gorillas. HIV-2 has crossed from monkeys (all or at least mostly from sooty mangabeys) to humans at least 8 times.
Are earlier cross-species transmissions to humans likely? The known probable minimum number of cross-species transmissions to humans of 12 suggests that cross-species transmission isn't an exceptionally rare event. The other thing that an answer must consider is whether or not it is likely that such earlier transmission was not noticed. The known history of HIV says "yes" to this. Of the minimum of 8 transmissions of HIV-2 from monkeys to humans, 6 were only found in a single human, with no known human-to-human transmission of these subtypes of HIV-2 (Bell & Bedford, 2017). Given that SIVsmm (simian immunodeficiency virus, sooty mangabey), the ancestor of HIV-2, appears to be a very old monkey disease, low-level monkey-to-human transmission in the past, with little or no following human-to-human transmission is likely. Even with a low level of human-to-human transmission, it would have been easy for the disease to remain unnoticed. For example, the strains that currently cause host human cases were first noticed in 1981 (initially in terms of symptoms, and a few years later the virus itself was identified) despite already having a long history of human infection. We don't know exactly how long. The earliest confirmed case was identified from a blood sample from 1959, and other cases were found via blood samples from c. 1969 (collected as part of research on Lassa fever). The genetic differences between strains suggests that HIV-1 was transmitted from chimpanzees to humans in approximately 1920-1930. Thus, HIV-1 appears to have been present in humans for over 50 years before it can to scientific/medical attention, even with growing numbers of infections. It would have been very easy for earlier monkey-to-human transmissions like the 6 known HIV-2 subtypes with only a single known human case to have been unnoticed.
Bell & Bedford (2017) note it is quite possible, likely even, that there have been many similar monkey-to-human transmissions, perhaps over 200,000 years.
There are some mysteries about cross-species transmission of SIV and HIV. It seems that the most frequent cross-species transmission is from hunting/predation, with infection occurring during butchering or eating the infected animal if eaten raw. Since chimpanzees have been observed hunting and eating monkey species that are known to carry SIV, monkey-to-chimpanzee transmission is straightforward. Since humans will hunt and eat monkeys and chimpanzees, transmission to humans is also unsurprising (and probably less likely than monkey-to-chimpanzee transmission, due to cooking). Indeed, the transmission of other diseases from chimpanzees to humans due to this kind of behaviour has been observed (one outbreak of ebola was from a chimpanzee that was found dead being butchered and eaten - the first cases were those who found the chimpanzee and brought it back, and those who butchered it - those who ate the cooked meat were OK unless they became secondary cases). have been observed to However, the ancestor of HIV-1 appears to have been transmitted from chimpanzees to gorillas, and gorillas, generally herbivorous, have not been observed to hunt or eat chimpanzees (or monkeys).
For a somewhat old, but still accurate enough to be useful, nicely readable review, see Watanabe (2004).
References:
Bell SM, Bedford T (2017), "Modern-day SIV viral diversity generated by extensive recombination and cross-species transmission", PLoS Pathog 13(7): e1006466. https://doi.org/10.1371/journal.ppat.1006466
Myrna E. Watanabe (2004), "Origins of HIV: The Interrelationship between Nonhuman Primates and the Virus", BioScience 54(9): 810–814. https://doi.org/10.1641/0006-3568(2004)054[0810:OOHTIB]2.0.CO;2