There was (and perhaps still sometimes is) an old bug, where if you hit the surface of a planet at high speed, you'd glitch right through the surface and be able to fly around "inside" the hollow planet. Kinda boring, since there's nothing in there but empty space and you can't enter Supercruise so have to fly around at normal-space speeds, and when it happened you needed rescuing by FDev because trying to punch back out through the surface again almost always destroyed your ship.
These days, the only way to get yourself trapped inside a planet is to fly into the path of a planet's orbit, log off, then time your logging-back-in-again to coincide with the arrival of the planet in that exact same location. Same result (getting trapped inside a giant hollow ball, needing to be rescued by FDev) but quite tricky to replicate, and almost impossible to do by accident.
So, not really a "cave" in the conventional sense of the word.