The story
(1570s) From snap + dragon, from a fancied resemblance, especially by playing children that the flower is a dragon that opens its "mouth" when squeezed on the sides. Compare for this sense the etymology of Dutch leeuwenbek (“snapdragon”, literally “lion's mouth”) and German Löwenmaul. An ancient name was Old English hundeshéafod (literally “dog's head”). For the parlour game sense, the 1704 Swift quotation is apparently the earliest appearance in print. Other animal-based names for the flower are common; compare Greek σκυλάκι (skyláki, literally “puppy”) and Finnish leijonankita (literally “lion's mouth”).
Etymology from Wiktionary, CC BY-SA 4.0.