Why Do Swim Trunks Have Linings?
The main function is for airflow. When you're out of the water, it's easier for you and your swim trunks to dry out, plus it keeps everything in place. It serves the same function that underwear does but avoids all the air bubbles and discomfort.
Why Are There Holes in Swim Trunk Pockets?
If you jump into a lake or pool with non-swimming shorts, you'll notice your pockets filling up like airbags: there is a lot more air-bubble action because the cloth is designed without water in mind. For swim trunks, there are holes in the pockets to make it easier for you to swim. After all, you're a man, not a buoy. The holes also let any extra water flow away without the need to invert your pockets.