A good way to look at it is that the dark wood is deadwood, and the light wood is livewood. Most deciduous species transport waste products to these areas, and this is especially true of oaks, where the old tannins are transported to these areas as well as the medulary rays which fan out from the centre of the tree.
Other reasons for dark heartwood is that often a tree is under dense shading from the canopy when it is in its juvenile stage, therefore the annual rings are much closer together. This is more frequent in shade tolerant trees such as Silver fir, where the heart can become black because the annual rings have to be measured in fractions of a millimetre. This sort of tree can remain under these conditions for many decades before being "released" when an opening occurs in the canopy. At the release stage, the annual rings become wider and therefore lighter. The difference in the colour of an individual ring is due to the changing cell wall thickness during the growing season. The early wood is lighter as the tree is putting on girth rapidly, and so makes many cells rather than putting energy into the creation of fewer thick cells. As the rapid early growth slows, the cells become thicker, and therefore darker until growth ceases. Hence at the end of the year, there is an abrupt change from dark late wood cells, to the light early wood cells of the following year's growth. This is why counting the rings lets you know how old a tree is.