Literary nonsense is like when you play make-believe with your friends and you say silly and crazy things just for fun. In books and stories, literary nonsense is when the author makes up words or ideas that don't really make sense, but are funny or clever.
Like imagine a story about a cat who wears pants and talks like a grown-up. That's very silly and nonsensical, but it's fun to imagine. Or a poem about a spoon that can dance and sing. It doesn't make sense in real life, but it's creative and imaginative.
Literary nonsense is often used in children's books because it's playful and can help kids use their imagination. Some famous examples of literary nonsense are Dr. Seuss books like "Green Eggs and Ham" and "The Cat in the Hat."