This time keeping scheme is based on the moon's rotation around the earth. It represents the influence of heavenly bodies (stars, planets etc ) on the life on earth. The establishment of this system requires a good knowledge of mathematics and astronomy.
All those stems and branches have either the yin or yang properties beside the properties of the 5 elements ( fire/earth/wood/metal/water).
You can read more about the 10 heavenly stems ( 天干 ) and the 12 earthly branches ( 地支 ) on :