I don’t recall what species specifically I’ve heard of this happening with (probably mostly snails), but every now and then lightning will strike (so to speak) and a critter will survive their pelagic larval stage in our tanks.
We don’t see this very often, though, because the odds of larvae surviving are overwhelmingly low due to factors like the lack of proper larval feeds (starvation), predation/aggression, mechanical equipment (which either kills the larva outright or filters/skims it out and kills it that way), etc.
As for how baby fish survive in the wild, my understanding is that most don’t (which is why so many species produce literally hundreds - or more - of eggs). The ones that do, however, are able to because of the availability of proper feeds, relative safety from predation and aggression (reefs have a lot more room for fish to swim away from aggressors, more places to hide from predators, higher populations of fish spawning regularly and producing a ton of offspring to spread the predation out more, and plenty of food options in addition to larval fish that are available basically at all times for predators; plus, a lot of pelagic larvae will basically drift through the open ocean away from most serious predators until they’re ready to settle - an option we don’t have with a traditional tank), etc.
So, to my understanding, it’s basically a numbers game/game of chance: in our tanks, the number of larval fish is low and the number of predators is high, so the odds of survival are super low. In the wild, the number of larval fish is high, and the number of predators is more moderate, so the odds of survival are higher.