Extrusive igneous rocks have a fine-grained (aphanitic) texture because they cool and solidify rapidly on Earth's surface—sometimes in hours or days. Crystals don't have time to grow large enough to see with the naked eye.
Intrusive (plutonic) igneous rocks cool slowly underground—thousands to millions of years. Crystals grow large and visible (phaneric/coarse-grained). Granite is the classic example.
Fine-grained = surface cooling = extrusive. Coarse-grained = deep cooling = intrusive. Porphyritic (mixed) = started deep, finished fast. The rock's texture is its cooling history, written in mineral grain.