All but three of the world's countries have rectangular flags. Switzerland and Vatican City have square flags. Then there's Nepal. The flag of Nepal has five sides made up of two triangles of different sizes. They have every right to design their flag as they see fit; after all, there is no international governing board for flag design. Maybe a better question is why all the other flags are rectangular.
Aside from the royal families, the only time one would really need to identify as part of a larger whole was in battle. Flags and banners were used to identify military units, but they were usually specific to the regiment or group of soldiers rather than the country as a whole. This all started to change during the Age of Sail, especially around the late 18th century. “It comes from trade on ships, which were moving between different places with the beginnings of globalization,” says Scot Guenter, a professor at San Jose State University, senior fellow at the Flag Research Center, and avowed vexillologist (that’s someone who studies flags).
The vast majority of national flags began to appear in the mid-1800s, along with the emergence of the nation as a concept rather than just the place one’s king ruled. This was the first time national flags were flown outside of war settings, and within a hundred years or so, flags became strangely homogenized in shape. They were simply tools to recognize a ship’s origin at a distance, and a rectangular flag is an ideal shape to catch wind and appear taut, allowing those far away to understand it.
An article at Atlas Obscura gives us a brief history of national flags, and then a look at why Nepal's flag is different.
(Image credit: MShades/Chris Gladis)
https://en.wikipedia.org/wiki/Flag_and_seal_of_Virginia
The wiki note (joke) that Sic Semper Tyrannis stood for "Get your foot off my neck" was definitely popular. Since it's the only state flag that has nudity, the other joke was that the fellas who designed it were probably drunk at the time.