Lava cools more rapidly above ground than it does underground because it's much colder above ground than it is underground, speeding up the process.
Think about it this way: If you put a cup of water in two freezers, and Freezer A had a lower temperature than Freezer B, the water in Freezer A would freeze quicker because it is in a colder environment. Hope this helps!