"waxy, fatty stuff in the head of certain whales," late 15c., from Medieval Latin sperma ceti "sperm of a whale" (it has when fresh something of the appearance of sperm), from Latin sperma "seed, semen" (see sperm) + ceti, genitive of cetus "whale, large sea animal" (see Cetacea). The substance in olden times was credited with medicinal properties, as well as being used for candle oil.
Use ... Sperma Cete ana with redd Wyne when ye wax old. [Sir George Ripley, "The Compound of Alchemy," 1471]
Scientists still are not sure exactly what it does. Sperm whale, short for spermaceti whale, is from 1830.