How do different igneous rocks form from one original supply of magma?
Igneous rocks form as molten material cools and crystallizes into rock. As the molten material cools, chemical compounds in the melt crystallize into minerals at different temperatures, with "high temperature" minerals crystallizing first. These high temperature minerals are denser than the molten material and tend to settle out in the bottom of a magma chamber (pluton). As the melt continues to cool, the composition of the melt changes as more crystals form and settle out. Finally the melt completely cools with the composition of the rock enriched in low temperature minerals. This process is called magmatic differentiation.
A simple comparison is what happens when seawater freezes. The ice that forms directly from seawater is nearly pure water in composition. As sea ice forms, the remaining seawater becomes enriched in dissolved salts, lowering the freezing temperature of the remaining seawater (concentrated as brine). As seawater freezes and crystalline ice forms, and liquid brine (concentrated salt water) and air are trapped in tiny pore spaces within a matrix of pure ice crystals. With further cooling, solid salt crystals subsequently precipitate in pockets of brine within the ice. The net volume of the ice, volume of brine, and chemical composition of the solid salts are temperature-dependent.
The chemical composition of a magma at the time when it cools determines the identity of the minerals which crystallize from the magma and therefore the identity of the resultant igneous rock. The most prevalent component of magma by weight is typically silica (SiO2). However, magma also contains in varying quantities ions of all the other elements (aluminum, Al, iron, Fe, calcium, Ca, sodium, Na, potassium, K, and magnesium, Mg) which compose the bulk of the earth's crust.
As a magma cools its constituent elements bond to form two different types of silicate minerals. These two types of silicates are divided according to which metallic elements they contain. The ferromagnesian silicates are rich in iron and magnesium, although they may also contain sodium or calcium. These include olivine (Mg2SiO4, Fe2SiO4), the minerals of the pyroxene group - enstatite, Mg2(Si2O6), hypersthene, Fe2(Si2O6), diopside, CaMg(Si2O6), and hedenbergite, CaFe(Si2O6) - and the minerals of the amphibole group - anthophyllite, (Mg,Fe)7(Si8O22)(OH)2, tremolite, Ca2Mg5(Si8O22)(OH)2, actinolite (Ca2Fe5(Si8O22)(OH)2), and glaucophane, Na2Mg3Al2(Si8O22), as well as biotite mica (K(Mg,Fe)3(AlSi3O10)(OH)2). In contrast, the nonferromagnesian silicates contain potassium, sodium and calcium rather than iron or magnesium. These include quartz (SiO2), the minerals of the feldspar group (orthoclase, K(AlSi3O8), albite Na(AlSi3O8), and anorthite (Ca(Al2Si2O8)) and muscovite mica (KAl2(AlSi3O10)(OH)2).
Igneous rocks which contain a high percentage of the ferromagnesian silicates tend to possess a dark color. In contrast, those igneous rocks which contain a greater percentage of nonferromagnesian silicates tend to have a lighter color.
Igneous rocks can be divided into two classes according to their proportional content of ferromagnesian and nonferromagnesian silicates. Igneous rocks composed mainly of dark, ferromagnesian silicates are said to be of basaltic composition. They are also called mafic rocks, the word mafic being derived from the first syllables of magnesium and ferrum, or iron. Because of their iron content such rocks tend to be both denser and darker in color than those rocks composed mainly of nonferromagnesic silicates. Igneous rocks which are composed mainly of the light-colored, nonferromagnesian silicates such as quartz and feldspar are said to be of granitic composition. Granitic rocks are also called felsic rocks, the word felsic being derived from the initial syllables of feldspar and silica (or quartz). Such rocks tend to contain a relatively greater percentage of silica (SiO2); typically this is about 70% by mass. Rocks with an intermediary composition are termed andesitic after the volcanic rock andesite.
See also: How to Use QAPF diagram to classify Igneous rocks?
References: 1 , 2 , 3, 4