The course of events was not complicated.
It turned out that on her way to Kyoto, Qing Ji encountered this Ashiya Doman, and upon seeing Qing Ji, he discovered her true identity. This old guy had some crooked ideas, wanting to subdue Qing Ji as his own shikigami.
Shikigami is also known as a servant god.
Typically, ordinary yin yang masters use spirit bodies that are invisible to the naked eye as shikigami. In this world, ghosts and demons with physical forms aren't weak. For yokai like Qing Ji, it's impossible to be made into a shikigami unless the yin yang master is extraordinarily powerful. This method of controlling ghostly entities is somewhat like a druid's animal spirit companion, except a yin yang master's methods are more extreme. Some malicious yin yang masters even personally refine shikigami, an evolution of witchcraft.
Subduing a yokai as a shikigami requires a secret magic contract; it's not as simple as capturing ordinary ghostly beings.
