She is having growing-pains.
This encompasses: physical and cognitive AND emotions.
They at this age, are not rocket-scientists about their emotions. It is taught.
Not even adults, are adept at it.
So for a 4 year old, keep this in perspective.
AND 4 years olds, much less adults, do not have automatic coping-skills either. This is taught, as well.
4 year olds are not expert at emotions or their feelings nor how to manage... said feelings. Not even all adults are.
Yes, she feels horrible for feeling crabby. She doesn't know why. She needs your guidance and consoling.
Teach her... how to know and say her feelings. The words for it.
Teach her how to... communicate.
Teach her.. .it is okay to be grumpy. Even adults are that way. But teach her... HOW to... manage it. Commiserate with her, then give her ideas... on how to shake it out. Either by joking or laughing or just making it into a silly thing. Coping-skills.
I tell my kids, EVEN Mommy gets grumpy. We all do. Its okay. BUT we TRY OUR BEST.....
And your daughter feels horrible about her 'bad' moments. So that is GOOD. Now teach her.. that she is not 'bad'... she just needs to, with your HELP, to LEARN other ways, of expressing that.
Because, you don't want her to be all clammed up... and then be afraid to tell you ANYTHING. Let her know she can communicate to you about anything.... and you are there for her.
But teach her HOW.... to say it.
Give her INCENTIVES, instead of punishments.
It does not have to be prizes.
But a hug, or smiley face sticker etc.
So that they do not equate, 'good behavior' with toys.
Encourage her.
Not just it being about her being "good" or "bad."
For me, I COMPLIMENT my kids on their EFFORTS. I know they are not perfect. Even I am not. So why and expect them to be "perfect?"
I value... that my kids "try their best...." Always.
Put your child to nap. When/if she is over-tired.
They get like this when sleep-deprived.