In OpenTTD, the headquarters or HQ is the building where all administration of your business is carried out. You can click on a headquarters to open the Company Window, to change any details for your company. It is not necessary to build.
The headquarters, like your company, will grow larger and upward to show your success as a company (growing bigger as company earns more Performance Rating points). Overall, there are five different stages for the headquarters, starting off as a small building no larger than a house, and finishing as a very tall skyscraper-sized building.
The headquarters also accepts any passengers and mail in its later stages that are delivered to it, as well as providing a limited amount of passengers and mail itself. During an economic recession there is only half of the usual amount of passengers and mail.
HQ #1 accepts nothing.
HQ #2 and #3 accepts passengers.
HQ #4 and #5 accepts passengers and mail.
As the HQ shows your success, it is common for players to build them as centerpieces of the transport empire, usually atop a large, artificial mountain, or on an island in the sea. It is not uncommon to see millions spent on such large areas.
There are various different NewGRFs available if you don't like your HQ design, or it seemingly dwarfed by other buildings in a town.