Terrible twos behavior. Of course it could be many things, though.
Generally speaking if everything is otherwise okay at home then they will benefit from consistency and explanations. Assuming there's good reason for them not to have something, it should be removed from them, the reason explained, and then they should be allowed to cry about it, possibly in a separate room. Kids don't know how to fully process their emotions but they will adapt over time to "can't have that thing I want" (most of the time).
It is possible that it is a learned behavior. When parents capitulate for bad reasons they teach the kid that getting upset is rewarded with the item.
It's really really hard to say anything definitive from afar. Kids may display "inappropriate" behaviors that are actually reasonable for their age, or they might be a learned bad behavior, it might be that they are neurodivergent in some way that should be accommodated, or, sometimes, they mean the kid is facing some form of abuse and is acting up because of it. It's very very difficult to give concrete suggestions with confidence from so far away.