What makes Wilde's play funny begins at line two of First Act, scene one. Algernon is heard playing the piano from the room adjoining the opening setting. He enters and asks his manservant, Lane, if he heard what was being played. Lane responds: "I didn't think it polite to listen, sir." This is funny because Lane is clearly being ludicrous: How could it be impolite to hear that which is very openly presented, and how can one not hear piano music played without secretiveness in the next room? In sum, Wilde throughout The Importance of Being Earnest has his characters, one right after the other, say quite ludicrous things with perfectly serious demeanor, as when Algernon later says:
girls never marry the men they flirt with. ... It accounts for the extraordinary number of bachelors that one sees all over the place.
The next thing that makes Wilde's play funny is represented in Algernon's rejoinder to Lane. Algernon says that he regrets that Lane didn't hear because even though he does not "play accurately--any one can play accurately," he does play with "wonderful expression"--wonderful feeling and wonderful emotion. This is funny because Wilde takes essential definitions of things--to play music is to play it accurately--and turns them the other way round while the characters see the illogical things they utter as perfectly logical. In sum, Wilde takes the assumptions of society and turns them into inverted paradoxes that poke fun at presumption and artifice in society. This point is further illustrated in a later exchange between Algernon and Lane:
Algernon. [Languidly.] I don’t know that I am much interested in your family life, Lane.
Lane. No, sir; it is not a very interesting subject. I never think of it myself.
Algernon. Very natural, I am sure.
The third thing that makes this play so funny is the interplay between names and identities that is introduced when Algernon says to Jack, who has recently come in and been directed to eat bread and butter instead of extravagant cucumber sandwiches: "you will have to clear up the whole question of Cecily."
The confusion of names and and identities is a satire on society's insistence on marriage to a person with a good name, which is a metonymy for having a good family background and lineage (metonymy: a word closely associated with a thing, place, or concept that stands in for that thing, place or concept, as in Washington for the U.S. government: e.g., It was decided in Washington today ....). It is this confusion of names and identities that comprises the bulk of the humor of the play, but the humor would attain lesser heights if not bolstered by the first two elements of humor.