Why are sperm whales called sperm whales
Sperm whales are named for their unique ability to produce and store a waxy, spermaceti-rich substance in their massive heads. This substance was highly useful for whaling operations and was believed to be sperm, which is how the species got its name. This waxy substance is used by the whales to change their buoyancy in the water, helping them dive deep and hunt their prey.
It is also believed that this substance helps focus the whales’ echolocation beams which allows them to more effectively target their prey.
Below are images relevant to your question