The following text is abridged from Wikipedia:
While "eggplant" is the common name in American, Canadian, and Australian English, "aubergine" is much more common in British English. It is known in South Asia, Southeast Asia and South Africa as brinjal.Some 18th-century European aubergines were yellow or white and resembled eggs, hence the name "eggplant".
The Arabic name, (al-)bāḏinjān is the common source of almost all European names for this plant. It came into mediaeval Latin as melongena (via the Byzantine Greek melitzána- influenced by the word for black). While English and French forms of this have become obsolete, the Italian word remains melanzana. The archaic English name mad-apple comes from this: the Italian was reinterpreted as mela insana.
In the western Mediterranean, (al-)bāḏinjān became Spanish berenjena, Catalan albergínia and Portuguese beringela. The Catalan form was borrowed by French as aubergine, which was then borrowed into British English.