The story
So-called because during the European explorations of the Middle East it was endemic to Baghdad, whereas unknown to other areas of the Middle East. The equivalent Arabic حَبَّة بَغْدَاد (ḥabba(t) baḡdād) was then only invented by Arabic-speaking foreigners.
Etymology from Wiktionary, CC BY-SA 4.0.