one day, he meets Edward Tudor, the Prince of Wales. Coming too close in his intense excitement, Tom is nearly caught and beaten by the Royal Guards. However, Edward stops them and invites Tom into his palace chamber. There, the two boys get to know one another. Fascinated by each other's life and their uncanny resemblance to each other and learning they were even born on the same day, they decide to switch places "temporarily". The Prince hides an item, which the reader later learns is the Great Seal of England, then goes outside; however, dressed as Tom, he is not recognized by the guards, who drive him from the palace. He eventually finds his way through the streets to the Canty home. There, he is subjected to the brutality of Tom's alcoholic and abusive father, from whom he manages to escape, and meets one Miles Hendon, a soldier and nobleman returning from war. Although Miles does not believe Edward's claims to royalty, he humors him and becomes his protector. Meanwhile, news reaches them that King Henry VIII has died and Edward is now the king.
Tom, dressed as Edward, tries to cope with court customs and manners. His fellow nobles and palace staff think the prince has an illness, which has caused memory loss and fear he will go mad. They repeatedly ask him about the missing Great Seal of England, but he knows nothing about it. However, when Tom is asked to sit in on judgments, his common-sense observations reassure them his mind is sound.
As Edward experiences the brutal life of a London pauper firsthand, he becomes aware of the stark class inequality in England. In particular, he sees the harsh, punitive nature of the English judicial system where people are burned at the stake, pilloried, and flogged. He realizes that the accused are convicted on flimsy evidence and branded or hanged for petty offenses, and vows to reign with mercy when he regains his rightful place. When Edward declares to a gang of thieves that he is the king and will put an end to unjust laws, they assume he is insane and hold a mock coronation.
After a series of adventures, including a stint in prison, Edward interrupts the coronation as Tom is about to be crowned as king. The nobles are shocked at their resemblance, and refuse to believe that Edward is the rightful king wearing Tom's clothes until he produces the Great Seal of England that he hid before leaving the palace.
Edward and Tom switch back to their original places and Edward is crowned King Edward VI of England. Miles is rewarded with the rank of Earl and the family right to sit in the presence of the king. In gratitude for supporting the new king's claim to the throne, Edward names Tom the "King's Ward", a privileged position he holds for the rest of his life.
The ending explains that though Edward died at the age of 15, he reigned mercifully due to his experiences, while Tom lived to be a very old man.