I don’t understand why

Why if you have sex a few days before your period it comes on early? Or If you have sex the day after it leaves it comes back like wtf

LET ME LIVE 😖