A quick search reveals the following information.
Control, chief of the Circus, suspects one of the five senior intelligence officers at the Circus to be a long-standing Soviet mole and assigns code names with the intention that should his agent Jim Prideaux uncover information about the identity of the mole, Prideaux can relay it back to the Circus using a simple, easy-to-recall codename. The names are derived from the English children's rhyme "Tinker, Tailor":
rich man, poor man,
Alleline was "Tinker", Haydon was "Tailor", Bland was "Soldier", Toby Esterhase was "Poor Man", and George Smiley was "Beggarman" ("sailor" was not used due to its similar sound to "tailor".)
As for the origins of the children's rhyme:
A similar rhyme has been noted in William Caxton's, The Game and Playe of the Chesse (c. 1475), in which pawns are named: "Labourer, Smith, Clerk, Merchant, Physician, Taverner, Guard and Ribald."
The first record of the opening four professions being grouped together is in William Congreve's Love for Love (1695), which has the lines:
A Soldier and a Sailor, a Tinker and a Tailor,
Had once a doubtful strife, sir.
When James Orchard Halliwell collected the rhyme in the 1840s, it was for counting buttons with the lines: "My belief – a captain, a colonel, a cow-boy, a thief." The version printed by William Wells Newell in Games and Songs of American Children in 1883 was: "Rich man, Poor man, beggar-man, thief, Doctor, lawyer (or merchant), Indian chief", and it may be from this tradition that the modern American lyrics solidified.
Essentially, it is indeed a list of essentially random professions, in imitation of various historical lines.