The play opens with Wang, a water seller, explaining to the audience that he is on the city outskirts awaiting the foretold appearance of several important gods. Soon the gods arrive and ask Wang to find them shelter for the night. They are tired, having travelled far and wide in search of good people who still live according to the principles that they, the gods, have handed down. Instead they have found only greed, evil, dishonesty, and selfishness. The same turns out to be true in Szechwan: no one will take them in, no one has the time or means to care for others – no one except the poor young prostitute Shen Teh, whose pure inherent charity cannot allow her to turn away anyone in need. Shen Teh was going to see a customer, but decides to help out instead; however confusion follows leaving Wang fleeing from the illustrious Ones, leaving his water carrying pole behind.
Shen Teh is rewarded for her hospitality, as the gods take it as a sure sign of goodness. They give her money and she buys a humble tobacco shop which they intend as both gift and test: will Shen Teh be able to maintain her goodness with these newfound means, however slight they may be? If she succeeds, the gods' confidence in humanity would be restored. Though at first Shen Teh seems to live up to the gods' expectations, her generosity quickly turns her small shop into a messy, overcrowded poorhouse which attracts crime and police supervision. In a sense, Shen Teh quickly fails the test, as she is forced to introduce the invented cousin Shui Ta as overseer and protector of her interests. Shen Teh dons a costume of male clothing, a mask, and a forceful voice to take on the role of Shui Ta. Shui Ta arrives at the shop, coldly explains that his cousin has gone out of town on a short trip, curtly turns out the hangers-on, and quickly restores order to the shop.
At first, Shui Ta only appears when Shen Teh is in a particularly desperate situation, but as the action of the play develops, Shen Teh becomes unable to keep up with the demands made on her and is overwhelmed by the promises she makes to others. Therefore she is compelled to call on her cousin's services for longer periods until at last her true personality seems to be consumed by her cousin's severity. Where Shen Teh is soft, compassionate, and vulnerable, Shui Ta is unemotional and pragmatic, even vicious; it seems that only Shui Ta is made to survive in the world in which they live. In what seems no time at all, he has built her humble shop into a full-scale tobacco factory with many employees.
Shen Teh also meets an unemployed male pilot, Yang Sun, whom she quickly falls in love with after preventing him from hanging himself. However, Yang Sun doesn't return Shen Teh's feelings but simply uses her for money and Shen Teh quickly falls pregnant with his child.
Eventually one of the employees hears Shen Teh crying, but when he enters only Shui Ta is present. The employee demands to know what he has done with Shen Teh, and when he cannot prove where she is, he is taken to court on the charge of having hidden or possibly murdered his cousin. The townspeople also discover a bundle of Shen Teh's clothing under Shui Ta's desk, which makes them even more suspicious. During the process of her trial, the gods appear in the robes of the judges, and Shui Ta says that he will make a confession if the room is cleared except for the judges. When the townspeople have gone, Shui Ta reveals herself to the gods, who are confronted by the dilemma that their seemingly arbitrary divine behavior has caused: they have created impossible circumstances for those who wish to live "good" lives, yet they refuse to intervene directly to protect their followers from the vulnerability that this "goodness" engenders.
At the end, following a hasty and ironic (though literal) deus ex machina, the narrator throws the responsibility of finding a solution to the play's problem onto the shoulders of the audience. It is for the spectator to figure out how a good person can possibly come to a good end in a world that, in essence, is not good. The play relies on the dialectical possibilities of this problem, and on the assumption that the spectator will be moved to see that the current structure of society must be changed in order to resolve the problem.