It just seems from a modern vantage to be an absurd concept. Cities spring from necessity and convenience, not from the will of one man, so to me it seems very strange that a person could just decree a city into existence. So how exactly did an ancient ruler just decide, "Here a city shall be" as it seems is so often stated in history books.
Cities spring from necessity and convenience, not from the will of one man, so to me it seems very strange that a person could just decree a city into existence.
Actually this isn't entirely true. Cities were not just little villages that grew, little by little and without foresight, over time. Even back in Ancient Greece and Rome, there were already cities built with purpose and planning, not just as products of random growth. The following excerpts are from The City in History by Lewis Mumford, 1961, any emphasis is my own.
[...] Cryne, founded in 630-624 [BC] in Lydia, boasted straight streets, crossing at right angles; while Naples and Paestum, Greek colonies planted in Italy in the sixth century [BC], actually exhibit a checkerboard plan throughout. This Milesian planning introduced, almost automatically, two other elements: streets of uniform width and city blocks of fairly uniform dimensions. The city itself was composed of such standardized block units: their rectangular open spaces, used for agora or temple, were in turn simply empty blocks. If this formal order was broken by the presence of a hill or a curved bay, there was no effort at adaptation by a change of the pattern. With this plan goes a clarification of functions and a respect for convenience: so the agora shifted toward the waterfront to be near the incoming ships and warehouses.
This geometric plan was not an easy one to apply to sites with an irregular topography; but it had one advantage that gave it currency in the sixth century and made it universal once more in the third century B.C.: it provided a simple and equitable method of dividing the land in a new city formed by colonization
That virtue belonged to no particular age or culture. If the architects of Alexander the Great used it in his seventy urban foundations, so did the Romans in establishing their own colonization settlements for army veterans [...]. This layout was used later in the building of garrison towns (bastides) in southern France in the fourteenth century A.D., and in Ireland in the seventeenth century; further, it was on the basis of the gridiron plan, with an open plaza in the middle, that the Spaniards laid out their colonial towns in the New World. Finally, the same type of plan, already more than two thousand years in use in Western Europe, became the basis of North American platown planning and town extension, from the founding of Philadelphia, New Haven, and Savannah onward.
The standard gridiron plan in fact was an essential part of the tools a colonist brought with him for immediate use. The colonist had little time to get the lay of the land or explore the resources of a site: by simplifying his spatial order, he provided for a swift and roughly equal distribution of building lots.
From the original twelve cities of Tuscany, and the thirty cities of Latium, the Roman state, by the Augustan period, had seeded a further three hundred and fifty towns in peninsular Italy and another eighty in northern Italy.
These towns were cut to the new pattern, modest in scale, simple in layout: almost the exact opposite of the sprawling disorderly mother city itself. Hygenus, the Roman architect, considered "the ideal...town should be 2,400 by 1,600 feet, since any greater length might endanger defense by indistinct signals along its walls. [...] Not enough has yet been made of the new towns that were built in the early days of the Empire, as holding points in the conquered lands. [...] the very scale of their construction implies the existence of what, drawing on England's contemporary pioneering, one may call a governmental, 'New Towns' policy.
The new towns seem all to have been planned for a limited population, around fifty thousand. That must have been the convenient limit of population. **Placentia (Piacenza) and Cremona were settled in the same year with six thousand families each. This would come, with slaves, to something like the standard population..."
So to answer your question, how can someone just decide to build a city? Well, in some cases, a colonist/state/etc decides it would be nice to have a city in a certain location, maybe for colonization/territory/veterans/etc, and they would use established plans for constructing a city, choosing its layouts, choosing what kind of facilities to include, and so forth. The city would then be populated with an existing population, say veterans/colonists/slaves/etc. There isn't just one way that all cities were ever built, but many cities have been built with some combination of these points for over 2000 years now.
This is not a complete picture, as I didn't include anything before ~600 BCE* or much detail on how exactly the process of making and populating one particular city goes, but I hope it helps shed a little light on what the history of city growth and planning actually is like, and that it's been a very long time since cities exclusively 'spring from necessity and convenience'.
* Edited thanks to /u/claird
The old saying goes, "Rome wasn't built in a day"! As it is, we do have surviving works from a Roman on how to found a city. Vitruvius, in his Ten Books on Architecture, describes the procedure. Although his focus in the Books was mainly military (he was a military man), he did write on civilian architecture and city planning.
As for why, check out /u/no-tea 's comment- Rome for example established cities for its veterans (legionnaires were given a parcel of land on retirement). Many cities started out as fortifications, strongpoints from which to control a crucial passage, land area, or resource- essentially places to project power from.
In my post I'll refer to Morris Hicky Morgan's translation- it's easily available online and very readable.
The first thing you'd need to do would be to find an actual site in the general area of where you want your city (Book 1 Chapter IV). A healthy site is foremost- away from marshes unless they are well-drained, at a good height, neither misty nor frosty, and not too hot. He mentions a very interesting point- sacrifice cattle that lived their lives on the site and examine their livers, in order to find out how healthy they were. A town has to feed itself- if the local food and water can't support cattle healthily, chances are any humans living there won't be either.
He gives the example of Old Salpia in Apulia as a town that was founded by some fine dude returning from Troy (like you're wondering about) on a stagnant marsh- the people suffered from frequent disease until they petitioned to be moved to a more healthy site. So it's not as though all the cities founded thus survived! We just don't hear very much about the ones that didn't get big.
Next: lay out your city walls and towers, dig down to rock, and start fortifying. You have an army standing around, right? Put them to work! Most of his comments are technical rather than conceptual, so I'll leave it to you to pore over Chapter V.
Once you have your fortifications, it's time to plan out the streets within the walls. Vitruvius was really big on winds and health, so it's no surprise that the streets are planned accordingly too. His understanding was that winds blow from 8 directions, so set your streets in such a way that the buildings block the wind and never let it rush directly through the streets.
Once you have your streets, you still need to plan where your public buildings are- the forum, and the various temples to the gods. These don't seem quite relevant to us now, but in his day these were quite literally the centers of public life.
Trade and food are important as well, though he only mentions them in passing. In the introduction to Book 2, he brings up Dinocrates who, presenting plans for a magnificent city to Alexander, had them rejected on account of the site not having fields nearby to support a large population. When Alexander went into Egypt, the conqueror chose a site with a nearby safe harbour for trade, and cornfields abound, and founded Alexandria there.
He doesn't delve into infrastructure until much later- finding water and public works for it in Book 8, but you need a source of that for your city as well! And boy, it's a whole book devoted to finding, testing, and transporting water. Interesting tidbit: in this book he mentions that Archimedes discovered what we now know to be the surface tension of water, and its relation to gravity.
Edit: and as a very practical man, Vitruvius constantly impresses on the reader the importance of adapting to local circumstances. Use local materials, observe how the natives build their dwellings to accommodate the weather, and even when planning for the wind the eight directions are just a guideline, because local conditions can and do change, and you'd rather have a sea breeze blowing through than wind from a nearby bog.
The Ancients had a good handle on what makes for a good city- arguably better than we do, confident as we are that technology / concrete makes up for everything. It's important to remember that by the time rulers were decreeing cities be put up, they actually had the manpower needed to put a city up, and a good understanding of what goes into a city.
It just seems from a modern vantage to be an absurd concept. Cities spring from necessity and convenience, not from the will of one man, so to me it seems very strange that a person could just decree a city into existence.
May I introduce you to Canberra, the capital city of Australia? Yes, that's right: Canberra, the eighth-largest city of Australia (and a city you've probably never heard of until now), is the capital of Australia, not Sydney of the opera house (and the largest city), nor Melbourne, the temporary capital of the Commonwealth of Australia from 1901 until the Commonwealth parliament was moved to Canberra in 1927.
It certainly did not spring from convenience, as it is an inland city perched on a plateau, while most major cities in Australia (certainly every capital city of every state and territory) are coastal. Arguably, perhaps, it sprang from necessity, since there was an intense rivalry between Sydney and Melbourne as to which city would be the capital, and Canberra was the compromise.
And the design of Canberra owed a lot to the will of one Australian, King O'Malley, who originally hailed from North America (the country is apparently disputed):
An international design competition was launched by the Department of Home Affairs on 30 April 1911, closing on 31 January 1912. The competition was boycotted by the Royal Institute of British Architects, the Institute of Civil Engineers, and their affiliated bodies throughout the British Empire, because the Minister for Home Affairs, King O'Malley, insisted that the final decision was for him to make rather than an expert in city planning.
More recently, Malaysia designated Putrajaya as its administrative capital, and has been moving most of its federal administrative functions to that city since 1999. The idea to have an administrative capital separate from the national capital (Kuala Lumpur or KL) was mainly the brainchild of the then-PM Mahathir Mohamad, although there was an arguable necessity in a desire to ease congestion in the national capital, and Putrajaya is conveniently situated between the airport and KL.
So it's not a very absurd concept from a modern vantage point. In fact, it would arguably be more feasible now than ever, since we have much better tools than the ancients did to raise a city.
I would point out St. Petersburg, Russia. Built by the command of Peter the Great, with peasants from across Russia ordered (or forced, if you prefer) to essentially colonize and build this city in a swamp by the Neva facing the cold Baltic Sea. Many died fulfilling the Tsar's command. Tsar Peter then strong armed his nobles and courtiers to build homes there if they wanted any preferential treatment or advancement from the Tsar.
This began in 1703. The city now has 5 million citizens.