The de-jure rulers of Qarth are the Pureborn, not the Thirteen or any other merchant faction.
Factions in Qarth
Following factions vie for dominance over Qarth:
- the Pureborn
- The Thirteen
- Ancient Guild of Spicers
- The Tourmaline Brotherhood
The actual de-jure authority of Qarth is the Pureborn. They are descendants of the ancient Kings and Queens of Qarth.
Descendants of the ancient kings and queens of Qarth, the Pureborn
commanded the Civic Guard and the fleet of ornate galleys that ruled
the straits between the seas
ACOK- Daenerys III
It was the pureborn that Daenerys had turned to, to plea for aid against Robert Baratheon.
The Pureborn heard her pleas from the great wooden seats of their
ancestors, rising in curved tiers from a marble floor to a high-domed
ceiling painted with scenes of Qarth's vanished glory. The chairs were
immense, fantastically carved, bright with goldwork and studded with
amber, onyx, lapis, and jade, each one different from all the others,
and each striving to be the most fabulous. Yet the men who sat in them
seemed so listless and world-weary that they might have been asleep.
They listened, but they did not hear, or care, she thought. They are
Milk Men indeed. They never meant to help me. They came because they
were curious. They came because they were bored, and the dragon on my
shoulder interested them more than I did.
However, being a merchant city, Merchants do wield a lot of influence on politics of the city.
The merchant princes, grown vastly rich off the trade between the
seas, were divided into three jealous factions: the Ancient Guild of
Spicers, the Tourmaline Brotherhood, and the Thirteen, to which Xaro
ACOK- Daenerys III
History of Qarth
Qarth was founded by Qaathi people who originated in the Dothraki sea region in the earliest days of humanity.
What can be said is that the Qaathi arose in the grasslands and
established towns there, coming into contact and occasional conflict
with the Sarnori. They would oft have the worse of these wars, and so
began to drift farther south, creating new city-states. One such,
Qarth, was founded on the coast of the Summer Sea. Yet the lands in
the south of Essos proved more inhospitable than those the Qaathi had
vacated, turning to desert even as they established their foothold
there. The Qaathi people were already well on their way to collapse
when the Doom struck, and any hopes of using the chaos in the Summer
Sea to their advantage vanished when the Dothraki attacked, destroying
all the remaining Qaathi cities save for Qarth
TWOIAF- Beyond the Free Cities: The
Most of the Qaathi cities were destroyed due to Dothraki invasions after fall of Valyria and ensuing century of blood save for Qarth.
In the south, other khals led their hordes into the Red Waste,
destroying the Qaathi towns and cities that once dotted that desert,
until only the great city of Qarth remained, protected by its towering
triple wall. Despite their long history, little can be said with any
certainty of the Qaathi—a people now gone from the world save for a
remnant in Qarth.
Most of these peoples are gone now, their cities burned and buried,
their gods and heroes all but forgotten. Of the Qaathi cities, only
Qarth remains, dreaming of past glories beside the jealously guarded
Jade Gates, which link the Summer and Jade seas. The others were
extinguished, driven into exile, or conquered and assimilated by the
people who succeeded them.
TWOIAF- Beyond the Free Cities:
Due to the city's strategic position on the eastern sea lanes, it soon turned into a trade hub which expanded when the Valyrian seapower vanished and Volantis became too occupied with its own ambitions west-wards during century of blood era.
Yet in a way, the Dothraki destruction led to a resurgence for Qarth.
Forced to look instead to the sea, the Pureborn who ruled Qarth
swiftly constructed a fleet and took control of the Jade Gates—the
strait between Qarth and Great Moraq, which joins the Summer Sea to
the Jade Sea. With the Valyrian fleet destroyed, and Volantis's
attention turned west, there were none to oppose them as they
established control over the most direct route between east and west,
and so gained immeasurably in both trade and levied tolls for safe
TWOIAF- Beyond the Free Cities: The Grasslands
In the Show however, it is implied that its the thirteen who rule the city and other rival factions and the pureborn are not mentioned as separate entities.
It seems to be one of the many changes show-runners made to limit the scope of events and things they had to film as it must have seemed inconsequential to the eventual planned story-arc they took in the show. The titles Spice-King, Silk-King and Copper-King are also their own invention, not adapted from the books. Although Westerosi nobles do use "Spice Lords" or "Cheese Kings" to refer to Essosi merchant quasi-aristocrat-class in a derogatory fashion. "Merchant Prince" has however been used in the books, a title Xaro Xhoan Daxos introduced himself with.
In any case, there is no mention of political history of Qarth in GoT so it is unknown how did they come to rule Qarth in the show.