When the process occurs in the depths of the Earth, we refer to plutonic rocks, also called "intrusive rocks". When it occurs at the surface of the planet, we speak of volcanic rocks, also called "extrusive rocks" or "effusive rocks".
Here we see a piece of gabbro, a plutonic rock, trapped in granite; this is called a xenolite. This rock comes from the east of the Sierra Nevada, Rock Creek Canyon, in California. © wikipedia-Mark A. Wilson