early 15c., probably from Middle French sisame and directly from Latin sesamum (nominative sesama), from Greek sesamon (Doric sasamon) "seed or fruit of the sesame plant," a very early borrowing via Phoenician from Late Babylonian *shawash-shammu (compare Assyrian shamash-shammu "sesame," literally "oil-seed").
First as a magic password in a 1785 translation of Galland's "Mille et une nuits," where it opens the door of the thieves' den in "Ali Baba and the Forty Thieves." The exact phrase open sesame is attested from 1793 in another translation, current since about 1826.