I would recommend that you follow up with your primary care doctor
about this issue. I think it is important to have the involved areas of your body (skin of the penis and around the anus) examined closely to see if there is any evidence if inflammation or rash. Sometimes a subtle skin finding might not be obvious to you but would be picked up by a doctor, which is why I recommend getting your doctor involved.
I agree with you that it is unlikely for this to be a sexually transmitted infection, and that it is more likely to be some form of local irritation, which might be related to your hospitalization. I also think it is unlikely to be a "bug" that you picked up in the hospital. Although picking up bugs is possible in the hospital, usually the symptoms would be more severe, such as fever
, obvious redness or infection of the skin, etc. I think it is more likely that you have some sort of allergic or irritant reaction to something you came in contact with in the hospital, which could include a detergent or soap product, latex, or some other chemical. Your doctor will be able to take a more detailed history and figure this out for you!