The hat that is called a "Panama Hat" is machine made from a fiber that is grown in Ecuador...it is made there too.
Panama does have its own hat but it is made from a fiber that is more stiff. See the photo (link attached below).
That hat is different. It is woven by hand. The best hats come from Cocle Province in the Interior of Panama. See the photo in the 2nd link.
According to the legend, when the construction for the Panama canal was underway, Teddy Roosevelt, the U.S. president came to Panama to view the progress. A Panamanian went to Ecuador and bought some of those soft fiber hats with the black hat band and brought them pack to Panama. He awarded one to President Roosevelt who liked it and wore it. All the members of his staff bought one and wore them. When they returned to Washington, a member of the Press Corps asked them about the hat. "They're Panama Hats." was the answer. And their fame was established.