There is no particular reason to believe herpes might be contributing; clearly the lesion initially was an injufy, and it sounds like it could have been repeatedly irritated by masturbation etc, delaying healing. On the other hand, it certainly is possible to have both problems; or for trauma to contribute to the severity of a lesion due to herpes, that might otherwise not be noticed.
If the test done by your doctor (undoubtedly a culture of the lesion) is positive for HSV, that will be defnitive. If negative, it won't tell much; many herpes lesions are culture-negative, especially when healing has started. In that case, you could have a blood test to see whether you are infected with HSV-1, HSV-2, both viruses, or neither one. (See other threads on "herpes diagnosis" to be sure your doctor requests the right kind of blood test.)
Good luck-- HHH, MD