In "The Importance of Being Earnest," Algernon uses the excuse of visiting a fictional invalid friend named "Bunbury" to visit Jack's estate, essentially pretending to need a break from social obligations to get away to the countryside and pursue his romantic interest with Jack's ward, Cecily.
"Bunbury":
This is the name of the invented invalid friend that Algernon uses to explain his need to leave town whenever he wants.
Masquerading as "Ernest":
When at Jack's estate, Algernon further pretends to be Jack's non-existent brother, "Ernest," which is the name that both Jack and Algernon use as their "in town" identities.