I don't think it can be underground, since Musk said it would cost $6 billion to build. Also, the plan is to build something similar for east-west coast travel, and underground would be even less possible.
The other consideration aside from cost is that seismic activity, even minor, can skew a tunnel. (Edit: for deep tunnels, that is. I have no idea about tunnels right below the surface.) That's bad news at high speed. I've given the tunnel approach some thought.[1]
And I keep hearing people trying to apply Hyperloop to coast-to-coast travel, but I don't recall Elon every saying anything about that long of a distance. In fact I recall him specifically talking about "the right city pairs", which implies some kind of distance limit.
I do wonder if there's something specific about LA to SF that enables the low low cost Elon's suggesting. Like the fact that they share a coastline with the Pacific Ocean.
The $6 billion cost seems too good to be true for any transportation system that would require significant land acquisition. California is set to spend some $60 billion on a train between these cities, and most of that cost is for right-of-way.