Let me explain it to you like you're a little kid.
Have you ever read or watched the movie of "The Hitchhiker's Guide to the Galaxy"? It's a really funny story about a guy named Arthur who travels in space with his friends, including a depressed robot and a space alien.
In the story, the dolphins on Earth suddenly disappeared, leaving behind a message in the oceans that says "So long, and thanks for all the fish." This means they are saying goodbye to humans and thanking them for all the nice things they have done for them, like feeding them and treating them well.
So basically, it's like when you say goodbye to your friends or family when you're leaving somewhere or moving away. You say "so long" to let them know you're leaving and "thanks for all the fish" to thank them for all the fun times you've had together or the things they've done for you.
It's a funny and creative way of saying goodbye, and it has become famous because of the book and movie.