According to an NPR article, it was Ike and the interstate highway system he implemented that killed off this mainstay of manly fashion.
Until cars became the dominant mode of personal transport, there was no architectural reason to take your hat off between home and office. With Dwight Eisenhower’s interstate highway system came cars, and cars made hats inconvenient, and for the first time men, crunched by the low ceilings in their automobiles, experimented with hat-removal, and got to like it.
As usual, the far reach of government impact in society has unforseen, unintended, and sometimes interesting consequences. In so many examples, economics is the trigger and social phenomena are the response, and often government is the source of a radical change in economics that has rippling sociological effects. Society is an organic thing: change the environment, and it will respond and adapt.
In this case, luckily, the result was an innocent shift in men’s fashion. There were other, more seriously detrimental effects of the highway system: poor neighborhoods were destroyed and paved over, dislocating thousands of people into ghettos and public housing.