Basically, a lava tube is formed when a underground lava flow stops flowing, leaving behind a long tubular cave.
A lava tube is a natural conduit formed by flowing lava which moves beneath the hardened surface of a lava flow. Tubes can be draining lava from a volcano during an eruption, or can be extinct, meaning the lava flow has ceased and the rock has cooled and left a long cave.
Lava tubes are a type of lava cave formed when a low-viscosity lava flow develops a continuous and hard crust, which thickens and forms a roof above the still-flowing lava stream. Tubes form in one of two ways: by the crusting over of lava channels, and from pāhoehoe flows where the lava is moving under the surface.1
This is what the lava tubes at Mammoth Cave (Utah) look like,