I think that some things are fun because our brain knows that the activity can make you happy and release dopamine.
For example, say you're going to play a game that you've never seen or played before. At first you probably won't be that in interested in it. But when you start playing it, you start to like the game. Then your brain documents it as fun, So when you see that game or think of it and start playing it, you will experience fun.
The reason why your brain probably thought of it as fun is because it's a game, and games are triggers for dopamine release when you win, advance in the game, get more points, etc. This is all due to primitive behaviors relating to triggers of dopamine.
Now say you're a kid and you're playing around with your friend. I think the reason that playing around with someone makes you happy and is fun is because that particular person makes you happy. So doing things with them such games will let you have fun.