It's pretty complicated to say what is the reason because each of us is different. I have the same mood swings, but not that often. It happens when I'm worried about something, and that worry makes me feel unconfident.
Also, I have anxiety, and that may also be a reason. But I don't know. I want to arrange a psychology appointment, but I'm afraid for now.