Rex, Jack Whitehall, is Queen Elizabeth II's favourite corgi, living a pampered life with three other corgis inside Buckingham Palace. During a visit by United States president Trump and his wife Melania Debra Stephenson, along with their dog Mitzi, the Queen suggests pairing one of her corgis with Mitzi. Rex is chosen, though he resists the idea. After he evades Mitzi's advances, she chases him into the dining hall where he accidentally bites Trump, angering the Queen Julie Walters.
Humiliated and ashamed, Rex is consoled by Charlie Dino Andrade, another of the Queen's corgis who is jealous of Rex's standing. Charlie schemes, disposing of Rex's collar and luring him to a stream with the false claim that the Pope is looking for dogs, intending to drown him.
Rex is saved by a man who takes him to a dog shelter. There he initially struggles to fit in, but he gradually makes friends and falls in love with a lively young Saluki named Wanda Sheridan Smith. Wanda's cautious heart opens, while Tyson, a former fighting American Pit Bull Terrier who also loves Wanda and runs the kennel, challenges Rex. Rex gathers the other dogs to oppose Tyson and prevail.
He returns to the palace with Wanda and his new friends, but the guards do not recognize him; Charlie has convinced the Queen that Rex was killed by foxes. Rex slips back inside as chaos unfolds, and everyone tries to stop Charlie from reclaiming the title of Top Dog. In a tense sequence, Charlie traps Rex and Wanda in a room and sets it on fire. Wanda escapes and rallies their friends to save Rex.
The Queen is overjoyed to find Rex alive and ready to be restored as Top Dog, but Rex chooses love over status. Charlie, now Top Dog, is forced to mate with Mitzi and move to America, while Rex remains at the palace with his chosen family.