Do UTI cause mood swings?

Possibly. This is one of those problems where a visit to your doctor is necessary to figure out what's going on. Only after a thorough evaluation, including examination and possibly labs and other tests, can your doctor correctly diagnose you and treat you effectively.
Well. If ur up all night peeing then there is a lack of sleep consolidation which can lower the stress threshold. Mix this with the pain of peeing and running to the bathroom constantly; it can indirectly cause a bad mood. If someone develops a severe infection and get sepsis then they get delirious generally.