HIV is transmitted by
1) having unprotected anal or vaginal sex, or
2) sharing intravenous drug needles with other people.
You cannot get HIV from the event you mentioned. Touching blood and then touching any other part of your body, including your penis, is NOT a risk for HIV. HIV transmission only happens inside the body - when an unprotected penis is inside a vagina or anus.