The story begins with two friends Ernest and Algy introducing their imaginary characters to each other. Ernest reveals that his real name is in fact Jack, and he has a ward in the country named Cecily who knows him as Uncle Jack. Algy reveals that he has an imaginary friend name Bunbury whom he uses as an excuse to avoid situations that he finds unpleasant. Ernest (or Jack) has fallen in love with Gwendolyn, Algy's cousin and she with him. Unfortunately, Gwendolyn's mother, Lady Bracknell disapproves of their union because of Jack's lack of "respectable relations." Jack is in fact an orphan who was adopted after being discovered in a handbag in a cloakroom in Victoria Station.
Algy arrives at the Manor house in the country and poses as Ernest in order to meet the beautiful Cecily. Jack returns in mourning and informs them that his brother, Ernest has passed away (Jack has been using the imaginary Ernest to explain his absence from the manor). Jack is furious with Algy (now called Ernest) and demands that he return to London, Algy refuses because he has fallen in love with Cecily.
When Gwendolyn arrives as well to pursue Jack. Gwendolyn and Cecily meet and both discover that they are engaged to Ernest. As both men arrive, Jack and Algy are exposed. Lady Bracknell arrives as well in pursuit of Gwendolyn and recognises Miss Prism, the governess of Cecily as a governess of her late sister's baby, until she disappeared one day, with the baby boy.
Miss Prisim confesses that she has accidentally left the baby in a handbag at Victoria Station. Everyone realises that Jack is in fact the little boy and is therefore the older brother to Algy. Furthermore, Jack's true name is revealed to actually be Ernest.