The story
Originally from the need to find public lavatories for children, possibly by analogy with the somewhat earlier-attested little boys' room, but already in broader euphemistic use by its first known appearance in John O'Hara's BUtterfield 8.
Etymology from Wiktionary, CC BY-SA 4.0.