Cherished by generations of readers, his irreverent fairy tales encouraged children to question authority and think for themselves.