In the history of China, the division of Yin and Yang first developed from the division of sacrifice. Early Oracle Bone Inscriptions wrote it at the time of sacrifice to record the answers of ghosts, ancestors and gods.
This is probably the earliest teacher of Yin and Yang.
Later, the teachers of Yin and Yang basically served the royal family, but because of the development of Taoism, they were all called Taoists, and the highest was the national teacher.
Actually, it's similar to what Japanese Yin and Yang teachers did.
To ward off evil spirits for the royal family, to refine the elixir for the emperor, to convey the so-called predictions of the gods, to observe the changes of the stars, to survey geomantic omen, and to build tombs.
You should read more about the name Yin from Japanese novels or cartoons, such as Abe Harumi, the most famous Yin figure in Japan.
Abe also serves the royal family, which is no different from China's belief in Buddhism.