Your ears often pop because the tunnel changes the air pressure around the train.
Air is always pressing in on your eardrums, but it’s usually balanced against the pressure of air inside the ear.
Going through a tunnel, air is forced past the train at higher speeds than outside: faster-flowing air exerts lower pressure, so the air inside your ear pushes the eardrum outward.
Swallowing or yawning evens out the pressure inside your ear and your eardrum returns to its normal position with a pop.
Coming out of the tunnel, your ears may have to pop again to get back to normal.