Named after the small cylindrical or hexagonal cases in which medicinal pills used to be sold.
pillbox hat (plural pillbox hats)