Why do yeast infections happen??

Ive been having sex and i got a yeast infection, does that mean he’s dirty? We don’t use protection