Avast there, Mateys
This hat, or a version of it, appeared as a reward during Speak Like A Pirate Day. You could get the hat and eyepatch separately or as a single hat and patch item.
Subsequently, it started appearing as a reward from the gift boxes. They were not identical though with 2 subtly different versions called Corsair and Mariner.
As ever, the item (which was only ever a cosmetic) looks better on some races - here's my Guardian modeling one:
You can see the Mariner version here
On Speak Like a Pirate Day, there are quests for the hat and patch:
The Tale of the Shipwrecked (Argirion)
Talk to Argirion just north of the Brandywine Bridge on the Buckland side. He has a small encampment set up just a bit from the shoreline. Upon speaking with him you will learn of their ships encounter with a storm. He and the Quartermaster were wwashed overboard and now he wants you to search for the Captain. Leave Argirionís camp and head north towards Evendum along the western bank of the Brandywine river. You will find the Captain and his ship near the turning point where the Brandywine turns to hit Lake Evendim on the map.
The Tale of the Shipwrecked Mariner (Captain)
After speaking with the Captain he will tell you to collect some of the items lost from the ship that now litter the shores from his location to south along the Brandywine shores. Collect these items and return to Argirion at his encampment and tell him what you learned. Pleased with your progress Argirion will complete your quest, but you will retain the collected items as barter.
Collect 10 Kegs of Cram
Collect 25 Bottles of Ale
Speak with the Quarter Master behind Argirion and you can cash these in on some piraty merchandise. Its not much use for gear, but it is a funny pirate like look that you can have some fun with.
Marinerís Hat and Eye Patch: A combination item that has a hat and patch that must be worn at the same time.
Marinerís Hat: The hat without the eye patch.
Marinerís Eye Patch: The eye patch without the hat.