Igneous rocks are formed from molten magma that cools and solidifies. This process can occur either below the Earth's surface, where it is known as intrusive or plutonic igneous rocks (such as granite), or on the surface after a volcanic eruption, known as extrusive or volcanic igneous rocks (such as basalt). So, the correct explanation is:
Igneous rocks are formed from molten magma inside the Earth that cool.