How did humans first get aids since its transmitted only through sexual contact?

Zoonosis. Aids / HIV is transmitted by blood as well. There's a scientific consensus by now that hiv1 is a chimp virus, and hiv2 a sooty mangebey virus, that passed into humankind from hunting bush meat (killing monkeys and apes for food, a nasty and bloody business.).