Yeast infection after sex

I got a yeast infection after my first time having sex it was horrible it was itchy and irritated. Why does this happen ?