“Cockney,” in the most literal definition, refers to a person born in the Cheapside area London, within earshot of the bells of St. Mary-le-Bow.
There is some debate about why Cockney rhyming slang was invented. The most prominent theory, Green said, is that in the 1820s and 1830s, other forms of slang had been worked out by the authorities, so criminals needed a new way to communicate without being understood. Under that theory, rhyming slang was created intentionally, as a sort of secret code.
A second theory is that its purpose was commerce, not crime. Some believe that the market traders of Cheapside made it up so they could communicate with each other without the customers understanding their conversations.
—Amanda Taub, “How to Speak in Cockney Rhyming Slang”