First of all, there was no HIV in your lab (unless one of the students has it). That's restricted to labs with intense safety measures, including restricted access. If you were working without latex gloves, then you can't have been in the same room with anything dangerous.
https://en.wikipedia.org/wiki/Biosafety_level
The trash box was probably empty before your class started using it.
Second, HIV isn't actually very infectious. Even if you touched an infected person's fresh blood, you would only have like a 20% chance of getting infected. Hepatitis infection is far more common, but that's still from a needle prick or splash in someone's face. Washing your hands should be plenty to keep you safe.
Finally, those boxes are made to prevent you from puncturing your finger on a needle. Needles and glass are dropped through a hole in the top of a plastic box so that your hand doesn't come near them. Non-sharp objects go in a trash bag that gets sealed when you're done using it. So there shouldn't have been anything spilled on the lid.