Some more information about when and how would be needed. Pictures help a lot too. There are several reason, I'll list a few below
A Bearded Dragon basking in his hot spot can open his mouth to thermoregulate. Which is a normal and a generally good sign.
Opening their mouth could be an issue if his nostrils were clogged from stuck shed or upper respiratory infection and he needs to open his mouth to breath.
How long have your had your dragon? And how old is he? Opening mouth can be a younger or new to you dragon being unsure of his new surroundings and acting defensively.