Symbolism, Imagery, Allegory
We have to wait a while for this one to make an appearance, but it's well worth the wait. The captain's hat doesn't become a symbol until the final paragraphs of the book. At first, it's a token of concern and respect for Leggatt, since the captain gives the thing to him to ward off the harsh Pacific sun:
And I watched the hat—the expression of my sudden pity for his mere flesh. It had been meant to save his homeless head from the dangers of the sun. (2.199)
But after Leggatt dives into the midnight water, the captain sees the hat and uses it as a marker to figure out what way his ship is moving:
And now—behold—it was saving the ship, by serving me for a mark to help out the ignorance of my strangeness. (2.199)
So in the end, the hat ends up saving the ship, just like helping Leggatt has saved the captain (at least in an emotional way).