Apparently, there's a huge cavity in the skull of the sperm whale that's full this oil, called spermaceti. It's oderless and tasteless, and is used for making candles and oils for lamps and cosmetics. There's a lot of oil in the skull. When the whalers caught the whale, they would cut a hole in the head and take out the oil in buckets, or they would have a guy jump in the hole and take it out manually.
They oil has special properties that might have helped the buoyancy of the whale. The oil has a melting and hardening point of about 6 degrees Celsius, and the temperature of the oil can be controlled by the opening and constricting of blood vessels in the nasal passages of the whale. If they want to dive, they just constrict the vessels, making the oil colder and harder, which causes the whale to sink. They can actually dive about 2 miles below sea level. And when they want to come up, they open up the blood vessels (I imagine this as flaring your nostrils), which melts the oil, which helps them float.