Volcanic rock, also known as extrusive igneous rock, forms when magma erupts onto the Earth's surface and cools rapidly, resulting in fine-grained textures. These rocks are crucial for understanding volcanic activity and provide insights into the composition of the Earth's crust and mantle.