The fedora was introduced in NetHack 3.0.0.
The fedora is a felt hat with a wide brim (about 2.5 inches or 6.4 cm) and a distinctive lengthwise crease in the crown; the style goes back as far as the 1880s. The name is derived from the 1882 Victorien Sardou play Fedora, in which actress Sarah Bernhardt (whom the play was written for) wore one while playing the titular "Princess Fedora"; the term itself would see regular use as the early 1890s. Fedoras were especially popular from the 1920s to the early 1950s, and fell out of widespread fashion after the mid-1950s - they are still occasionally seen worn as accessories in the modern day.
The Indiana Jones franchise is first set in 1936, and is significantly inspired by Secret of the Incas and its main character, Harry Steele - the fedora's inclusion in NetHack is part of the Archeologist role's homage to the series.
Variants and patches
Variants tend to play up the Indiana Jones homage more, and sometimes opt to make the fedora somewhat like a luck item.
In UnNetHack, the fedora increases base Luck by 1 for Archeologists when worn; they can also safely enchant one at a maximum of +5. In addition, a fedora may be found along with an archeologist corpse under a rolling boulder trap.
In addition to retaining SLASH'EM changes, SlashTHEM also has straw golems that drop an eroded fedora upon death.
In xNetHack, Archeologists can safely enchant fedoras from a maximum of +5, and there is a chance to find one on an archeologist corpse in the path of a rolling boulder trap - both changes were adapted from UnNetHack.
Some hats can only be worn if you're willing to be jaunty, to set
them at an angle and to walk beneath them with a spring in your
stride as if you're only a step away from dancing. They demand a
lot of you.
[Anansi Boys, by Neil Gaiman]