Ambergris is exceptionally rare and unusual, It is not necessarily "whale poop" or "whale vomit." To be specific, it can come out either end. This strange substance is secreted in the intestinal tract of the sperm whale. Most blobs of ambergris are found along with the sharp beaks of giant squid, so the leading theory is that the sperm whale coats these beaks with ambergris in order to pass them safely through its intestines, somewhat in the way that an oyster coats a grain of irritating sand with nacre to create a pearl.
And just like a pearl, ambergris can be worth a small fortune.