Help! Bleeding during sex

I’ve been spotting lightly and my breast is sore af for the past 2 days. So my boyfriend and I had sex today and there was blood like im in my normal period. After that, the bleeding stopped. Please explain why this happened. My next period is on the 22nd of January if that helps.