The Frogs tells the story of the god Dionysus, who, despairing of the state of Athens' tragedians, travels to Hades (the underworld) to bring the playwright Euripides back from the dead. (Euripides had died the year before, in 406 BC). He brings along his slave Xanthias, who is smarter and braver than Dionysus. As the play opens, Xanthias and Dionysus argue over what kind of jokes Xanthias can use to open the play. For the first half of the play, Dionysus routinely makes critical errors, forcing Xanthias to improvise in order to protect his master and prevent Dionysus from looking incompetent—but this only allows Dionysus to continue to make mistakes with no consequence.
To find a reliable path to Hades, Dionysus seeks advice from his half-brother Heracles, who had been there before in order to retrieve the hell hound Cerberus. Dionysus shows up at his doorstep dressed in a lion-hide and carrying a club. Heracles, upon seeing the effeminate Dionysus dressed up like himself, can't help laughing. When asked which road is the quickest to get to Hades, Heracles replies that you can hang yourself, drink poison, or jump off a tower. Dionysus opts for the longer journey, which Heracles himself had taken, across a lake (possibly Lake Acheron).
When Dionysus arrives at the lake, Charon ferries him across. Xanthias, being a slave, is not allowed in the boat, and has to walk around it, while Dionysus is made to help row the boat.
This is the point of the first choral interlude (parodos), sung by the eponymous chorus of frogs (the only scene in which frogs feature in the play). Their croaking refrain – Brekekekèx-koàx-koáx (Greek: Βρεκεκεκὲξ κοὰξ κοάξ) – greatly annoys Dionysus, who engages in a mocking debate (agon) with the frogs. When he arrives at the shore, Dionysus meets up with Xanthias, who teases him by claiming to see the frightening monster Empusa. A second chorus composed of spirits of Dionysian Mystics soon appear.
The next encounter is with Aeacus, who mistakes Dionysus for Heracles due to his attire. Still angry over Heracles' theft of Cerberus, Aeacus threatens to unleash several monsters on him in revenge. Frightened, Dionysus trades clothes with Xanthias. A maid then arrives and is happy to see Heracles. She invites him to a feast with virgin dancing girls, and Xanthias is more than happy to oblige. But Dionysus quickly wants to trade back the clothes. Dionysus, back in the Heracles lion-skin, encounters more people angry at Heracles, and so he makes Xanthias trade a third time.
When Aeacus returns to confront the alleged Heracles (i.e., Xanthias), Xanthias offers him his "slave" (Dionysus) for torturing, to obtain the truth as to whether or not he is really a thief. The terrified Dionysus tells the truth that he is a god. After each is whipped, Dionysus is brought before Aeacus' masters, and the truth is verified. The maid then catches Xanthias and chats him up, interrupted by preparations for the contest scene.
The maid describes the Euripides-Aeschylus conflict. Euripides, who had only just recently died, is challenging the great Aeschylus for the seat of "Best Tragic Poet" at the dinner table of Pluto, the ruler of the underworld. A contest is held with Dionysus as judge. The two playwrights take turns quoting verses from their plays and making fun of the other. Euripides argues the characters in his plays are better because they are more true to life and logical, whereas Aeschylus believes his idealized characters are better as they are heroic and models for virtue. Aeschylus mocks Euripides' verse as predictable and formulaic by having Euripides quote lines from many of his prologues, each time interrupting the declamation with the same phrase "ληκύθιον ἀπώλεσεν" ("... lost his little flask of oil"). (The passage has given rise to the term lekythion, literally 'oil-flask', for this type of rhythmic group in poetry.) Euripides counters by demonstrating the alleged monotony of Aeschylus' choral songs, parodying excerpts from his works and having each citation end in the same refrain ἰὴ κόπον οὐ πελάθεις ἐπ᾽ ἀρωγάν; ("oh, what a stroke, won't you come to the rescue?", from Aeschylus' lost play Myrmidons). Aeschylus retorts to this by mocking Euripides' choral meters and lyric monodies with castanets.
During the contest, Dionysus redeems himself for his earlier role as the butt of every joke. He now rules the stage, adjudicating the contestants' squabbles fairly, breaking up their prolonged rants, and applying a deep understanding of Greek tragedy.
To end the debate, a balance is brought in and each are told to tell a few lines into it. Whoever's lines have the most "weight" will cause the balance to tip in their favor. Euripides produces verses of his that mention, in turn, the ship Argo, Persuasion, and a mace. Aeschylus responds with the river Spercheios, Death, and two crashed chariots and two dead charioteers. Since the latter verses refer to "heavier" objects, Aeschylus wins, but Dionysus is still unable to decide whom he will revive. He finally decides to take the poet who gives the best advice about how to save the city. Euripides gives cleverly worded but essentially meaningless answers while Aeschylus provides more practical advice, and Dionysus decides to take Aeschylus back instead of Euripides. Pluto allows Aeschylus to return to life so that Athens may be succoured in her hour of need, and invites everyone to a round of farewell drinks. Before leaving, Aeschylus proclaims that Sophocles should have his chair while he is gone, not Euripides.

Question: How does Xanthias betray Dionysus while having switched clothes with him?
Answer: He offers Dionysus over for torturous questioning as if Dionysus is his slave.
Alternative answer: He offers Dionysus as a slave to Aeacus