if you want to access the specific resources, you need to use L3 VPN.
but if you want to access the entire resources, you need to use L2 VPN.
With a L2 VPN, site A and site B, look act and feel like they are on the common L2 network together. A router at site A can be an OSPF neighbor with a router at site B, as they appear directly connected.
With a L3 VPN, we don't have a direct connection between sites at L2. With a L3 VPN, we peer with the SP edge, and by learning routes from the SP, we have L3 connectivity between sites A and B.
It was the best explanation depicted by Keith here, but just to add on that.
Purpose of both the way of VPN connectivity is same, to connect two different site. The only difference is the way we connect both the site together for intercommunication.
In both the VPN stlye we use Service provider network to traverse from one site to other.
L3 VPN: Here we make direct connectivity with edge device of service provider, and this we have to do at both the end. next we have to share our local routes with Service provider, which eventually transmitted to the other end of your VPN (i.e. your other site). So here service provider knows about our local routes. This way both the site have each others routes, making it L3 connectivity (As we have L3 routes)
L2 VPN: As Keith Said, connectivity in L2 VPN looks like both the site are on same L2 network together. To achive this Service provider make a predifine virtual connection in their network, known as psudowire connection, between your two sites. So here we dont have to share our local routes with service provider, so service provider stays transperant with about our internal routes. In L2 VPN communication happens in the same way we do at our single site local network.
Not to be to snarky about it, but one is an L2 connection, the other is an L3 connection..
If just about how you want your customers to be connected (if you are the SP) and how much, or how little, interaction you want to play in the middle.