Historically, Cao Cao had no relationship with Cai Wenji. He only had literary exchanges with Cai Wenji's father, Cai Yong, and spent a lot of money to redeem Cai Wenji and let Cai Wenji marry Dong Si.
Cai Wenji is knowledgeable and talented, and is good at literature, music, and calligraphy. She first married Wei Zhongdao and returned home after her husband died. At the end of the Eastern Han Dynasty, there was great chaos in the Central Plains. The Southern Xiongnu who originally surrendered to the Han Dynasty took the opportunity to rebel. Cai Wenji was captured by the Xiongnu King Zuoxian and gave birth to two children.
In the eleventh year of Jian'an, Cao Cao always loved literature and calligraphy, and often had literary and calligraphy exchanges with Cai Wenji's father, Cai Yong. Seeing that Cai Yong had no heirs, Cao Cao used a golden jade to redeem Cai Yan from the Southern Huns and married Cai Wenji to Dong Si.
Extended information:
There have always been different opinions on whether Cai Wenji married King Zuoxian in the north: According to the "Book of the Later Han Dynasty", Cai Yan "did not marry" Zuoxian King, rather than "marrying" King Zuo Xian, and generally the wives of Huns kings are called "Yanshi", but Cai Yan did not have this title during his twenty years in the north, so it is believed that Cai Yan and King Zuo Xian are not the same Spousal relationship.
But another theory is that Cao Cao spent a very large price to redeem Cai Yan, far exceeding the price of an ordinary slave. It can be seen that Cai Yan's status with the Huns is not low. Some literary and artistic works, such as Peking Opera, wrote Cai Wenji as the concubine of King Zuoxian. There is still controversy as to whether the two statements are true or false.