Yin and yang, as to origins, refer to the sunny and shady side of a stream. Yang is of course the sunny side while yin is the shady side.
Earth and Sun are also associated with the feminine and masculine principles as well as passive and active principles.
The way of nature is the interplay of light and dark. They combine in various modulations that constitute the world and its way.
The light and dark speak to the opposites such as heavy and light, good and bad, seeing and not seeing, hearing and not hearing, touching and not touching, sun and moon, heaven and earth, and so forth.
None are considered better or worse but rather as two balancing principles on which the world, Earth, rests: light and dark.
The sun and moon were the celestial bodies that first influenced such thinking in ancient China and let to the I Ching - Book of Changes.
Campbell, Joseph. "Myths of Light: Eastern Metaphors of the Eternal." New World Library. Novato, California. 2003.