Why That Hat? Investigated
Chefs wear a chef's hat. Soldiers wear a beret. BUT WHY?
Please note: this is a topic I have ~0 preexisting knowledge about; I found one reasonable source for each hat then stopped, so ~any information listed here may be wrong.
Chef's Hat
The excellent Daniel Engber did a New York Times Magazine piece about this in 2014. Apparently the revolution was started by Antonin Carême in 1822.
While working for the British ambassador in Vienna, Carême got the idea to insert a round piece of cardboard inside the floppy cap that was then standard headgear in the kitchen.
“A cook should present as a man in good health,” he explained, “and our regular hat suggests a state of convalescence.”
Insert your own entendre, frankly. Carême provides this helpful comparison:

Note the chef at left is wearing what we would now consider a night-cap. In the long run, a round muslin toque won out, but more in our imaginations than in actual modern kitchens, where I think people just wear hair-nets. Why the tall muslin toque, though? Engber tells us:
This remains a mystery. Some scholars have suggested that the toque derives from the headgear of Ottoman soldiers. A military model does fit with the fact that hat size in the kitchen connotes rank. “Only the highest people in the hierarchy wear the toque, not the prep cooks and the dishwashers."
Insert your own entendre indeed; I prefer friend-of-the-blog S's explanation that if chef's didn't wear such tall hats they'd have no place to hide a racoon.
Soldiers' Berets
Look, I just always found it kind of ridiculous that soldiers wear the same iconic hat as artists? To demonstrate this absurdity, please see this image of our blog's mascot, Atticus von Bittendorf, wearing two hats:

I feel like this explanation is not truly satisfying, but it's the best I can find:
Berets have features that make them attractive to the military; they are cheap, easy to make in large numbers, can be manufactured in a wide range of colors encouraging esprit de corps, can be rolled up and stuffed into a pocket or beneath the shirt epaulette without damage, and can be worn with headphones
More satisfyingly but less relevantly, this blog has the distinction of 1) being only about berets, 2) being on blogspot in 2025, 3) having posted seemingly-daily for over 15 years. It's a marketing funnel for this beret vendor, which I wouldn't normally advertise, but honestly look at this range of beret options:

p.s. as a bonus, here's a great article about bishop vs pope hats: the pope is also the bishop of Rome, and if you're an amateur pontiff-spotter you may well be confusing his bishop's hat for a pope hat: https://www.exurbe.com/spot-the-saint-the-four-doctors-saints-hats/