Can someone explain ? STI question

Okay so when I was a few weeks pregnant at my first appointment they did labs and it came back positive for chlamydia I told my sons dad ( who was very crazy and abusive ) he accused me of cheating and being a whore but I had no idea I even had it he refused to get tested so i refused to sleep with him until he forced me to have sex with him I went to the dr soon after to tell her what happened and that I needed to be tested again but the test came back negative I’m confused at how I had it and he didn’t we had sex a lot before I became pregnant.