The origins are steeped in history... Bloody Mary!
The Mary alluded to in this traditional English nursery rhyme is reputed to be Mary Tudor, or Bloody Mary, who was the daughter of King Henry VIII. Queen Mary was a staunch Catholic and the garden referred to is an allusion to graveyards which were increasing in size with those who dared to continue to adhere to the Protestant faith - Protestant martyrs.
Instruments of Torture!
The silver bells and cockle shells referred to in the Nursery Rhyme were colloquialisms for instruments of torture. The 'silver bells' were thumbscrews which crushed the thumb between two hard surfaces by the tightening of a screw. The 'cockleshells' were believed to be instruments of torture which were attached to the genitals!
The "Maids" or Maiden was the original guillotine!
The 'maids' were a device to behead people called the Maiden. Beheading a victim was fraught with problems. It could take up to 11 blows to actually sever the head, the victim often resisted and had to be chased around the scaffold.