This phrase is used to describe someone's bad mood that is obvious to others. He's been like a bear with a sore head ever since he lost his job.
Pro Tip 2/3
Informal
It's mostly used in casual conversations, not in formal writing or speech. I wouldn't ask for a favor today; she's like a bear with a sore head.
Pro Tip 3/3
Visual Imagery
The phrase creates a vivid picture: imagine how a bear would act if it were in pain. When he has a headache, he's just like a bear with a sore head, avoiding everyone.