And the answer isn't necessarily, 'for fun' :-)
(Which is actually one of the answers I get when I ask my first-year students, 'why sex?')
At the moment my lunchtime reading is Natalie Angier's 1995 book The beauty of the beastly. This is a collection of essays that were originally written for the New York Times newspaper, about all manner of animals. Some of them we might indeed find to be beastly (her own pick for this label would be cockroaches, but there are scorpions, snakes...), yet she manages to bring out the beauty of them all. And there are other topics: how & why DNA is wrapped & coiled so tightly in the nucleus, how the hormone oxytocin works its magic on maternal behaviour - and why the young of some species play.
Because our own species does truly find enjoyment in play, we sometimes assume that other animals do so as well. Yet as Angier points out, play is expensive, & can be dangerous - surely this would provide good evolutionary reasons not to indulge? For example, the boisterous play of antelope, rats, & our own children can burn up to 20% of non-essential calories (those not required simply for keeping us alive) in play. That energy isn't being used for growth. And it's being burned in leaping, biting, 'play-fighting' - activities with the potential to cause real bodily harm. (Although that perhaps is less applicable to kids today, given our tendency to bubble-wrap them to avoid all possible sources of harm.)
So why do they do it? Angier notes that there's evidence that play is most vigorous during that period when brain cells are at their busiest in forming synaptic connections with each other. Much of this neural path-forming is going on in the cerebellum, which oversees such things as coordination & motor control. So playing may help with motor development, & also with the growth & development of muscle tissue.
And there's more - play allows young animals to practice behaviours that they'll need in adult life. (OK, they don't play mummies & daddies; their needs are perhaps more urgent.) Much of this behaviour is quite ritualised, but we see young herbivores mock-fleeing from non-existent hunters, and young carnivores practising hunting. And maybe that mummies-&-daddies crack was unwarranted: Angier describes young sea turtles (not animals you'd normally regard as playful) practising courtship behaviour as hatchlings. And young rats will practice nurturing behaviours when given access to newborn pups. Primates are particularly playful, & a lot of that play goes into developing and maturing the social skills needed in their often-complex societies.
Play - there's more to it than you might think.
N. Angier (1995) The beauty of the beastly. pub. Abacus