In a nutshell
A priority queue always hands you the most important item next, not the one that arrived first. It's usually built on a min-heap — a tree where every parent is smaller than its children, so the smallest (highest-priority) value sits at the root, always one peek away. Adding an item lets it bubble up to its rightful level, and removing the top pulls a leaf up and lets it sink down, each in about log-n steps. It powers schedulers, Dijkstra's shortest paths, and event simulations.