Hello and welcome to e health forum.
A sorethroat or throat pain is usually caused by irritation or inflammation of the throat (acute pharyngitis).
The most cause is due to viral infections (80%). Most common viruses that cause sore throat include influenza, adenovirus, coronaviruses, etc which are the most commonly involved in respiratory infections.
Other causes include bacterial infections (like streptococci, diptheria, Arcanobacterium haemolyticum) and fungal infections (Candida).
The proper diagnosis of the underlying condition depends on a clinical examination and if needed a few blood tests.
Based on that, either antibiotics can be prescribed or supportive therapy can be suggested.
Regarding to HIV, just as any other viral infection, sore throat is a sign of inflammation, but is not a specific finding that can be used to diagnose HIV.
HIV infection is spread to individuals not by direct skin contact or by just being in the same room. It is spread by sexual contact or by inoculation of the virus into the blood stream.
In case, you think, you had exposure to HIV, you might consult your doctor and undergo screening for HIV, to clear your doubts and confirm your status.
I hope this helps.