The result of this tutorial

Procedural caves

An awesome video tutorial by Sebastian Lague on how to create procedurally generated caves using cellular automata and marching squares.

The tutorial series is on youtube, but Unity has actually included in in their official learn section so I'm linking that instead:

The source code for the tutorial, and an entire example project with examples of both 2D and 3D cave generation, is available from Sebastian's github, here:

Sebastian has a bunch of other really good video tutorials worth checking out.