How Trichomoniasis came about?

So Sunday my bf and I had sex vaginally after anal. The next day I decided to call my doctor to make sure no bacteria was in there. Today I went to the doctor he told me I had trich like how? I didn’t cheat and I’m sure he didn’t either. I know I didn’t have it when I was pregnant so how did this happen? We’ve been together for almost 2 years in April. I’m stressing this now... I’ve read it could’ve came from toilets or shared towels. I do use public toilets. I told my bf we got it from anal to vaginal cause my cousin said that’s how she used to get it but I looked it up and now I definitely don’t believe her.

Someone please give me advice!