The ways by which one can have
HIV are usually through sexual contact, blood transfusions, from parents to children, use of shared needles, contact with blood stained fluids etc from infected persons. If you have not had any of these then it's less likely that you have HIV. But the doctor might have asked it for evaluation for some specific reason which probably he/she can tell you better.