This study is aimed at assessing the willingness to participate in the HIV vaccine trials and the associated factors among people who inject drugs (PWIDs) in Tanzania. Information about the willingness to participate and the associated factors was collected using interviewer-administered questionnaires at the medication treatment for opioid use disorder (MOUD) clinic in Dar es Salaam. Data analysis was performed using the IBM SPSS Statistic 20. The mean age of respondents was 36.7, and the standard deviation (SD) was ±7.2. The majority of respondents (68%) had primary education, and a high proportion of them were single (61.5%). More than one-third (37.9%) shared needles and syringes. Most (87.3%) had more than three sexual partners, and almost half (51.4%) did not use condoms during sexual intercourse with nonregular partners. About 63% had knowledge of HIV transmission while 27% had heard about HIV vaccine trials. Generally, 76% of the respondents expressed willingness to participate in future HIV vaccine trials regardless of prior knowledge of HIV vaccine trials. Willingness to participate in HIV vaccine trials was not associated with education level, people living with, knowledge about HIV transmission, awareness of HIV vaccine trials, sharing of syringe/needles, and number of sexual partners. Only older age (OR=1.6, 95%CI=1.01, 2.6) and condom use (OR=0.49, 95%CI=0.26, 0.97) showed an association with willingness. However, after performing logistic regression with factors at p value ≤ 0.2 to ascertain the other factors on the effects of age, condom use, education level, and sharing of needles/syringes, the results were not statistically significant. Although participants reported a high willingness to participate in hypothetical HIV vaccine trials, no definitive conclusion can be drawn about the associated factors. Further studies with intensive educational programs are needed to investigate the factors on willingness to participate in actual HIV vaccine trials among PWIDs.