The Romance of the Three Kingdoms depicts Liu Bei as being a good man, an embodiment of the Confucian virtues, and opposes him to Cao Cao, more vicious than virtuous, saying "I'd rather betray the world than let the world betray me". It is also my understanding that the 擁劉反曹 Support Liu oppose Cao way of thinking was pretty strong regarding the Three Kingdoms.
Why is that? The historical Cao Cao doesn't appear to me as being worse than the average Chinese warlord, I could even see the point being made that he was relatively okay as far as warlords go, and the usurpation of the throne by Cao Pi is not that different from the way other dynasties started. Why did later scholars not frame the way Cao Pi became an emperor the usual way, that is the Han lost the Mandate of Heaven and the Cao family obtained it?
You might be interested in answers by u/lordtiandao and myself to "How did Liu Bei and his entourage come by the Ming dynasty to be regarded as the legitimate successors to the Han, while Cao Cao et al--despite receiving the lawful abdication of the Han and abdicating willfully to Jin--were cast as villains?"
I can't speak for the Ming era itself but I can speak of the changing attitudes towards Cao Cao over time
When Jin unified the land and thus being the 100% unimpeachable successors to the mandate of heaven, it was in their interests for the mandate of heaven line to go Han-Wei-Jin. That Emperor Xian's abdication was a legitimate means for Cao Pi to ascend as it was for Sima Yan to ascend for Cao Huan's abdication. The Han had exhausted their mandate, Cao Cao had unified most of the land, restoring order and success, the Sima's had served the Cao family and drew upon what had been built before to unify the land. The former Shu-Han officer Chen Shou unsurprisingly follows that in the way he compiled and edited the Records of the Three Kingdoms as a Jin scholar.
For some dynasties like the Tang and Northern Song, drawing upon Cao Cao was useful. The main leader in the north, control of the traditional capitals, a great military leader, a scholar with scholarly descendants, Cao Cao's glory could be used to compare with their own. Cao Cao and his court were the subjects of stories of wit for the enjoyment of scholars but even in the days of Jin, Cao Cao's reputation problems had begun.
The Sima's needed the Cao's to be the rightful successors of the mandate but also not so good because why then would the Sima's usurp power? A lot of this could be pinned down to the "failings" of those that came later, figures like Cao Fang and Cao Shuang, but some of it reflected on Cao Cao. The eccentricities, the low birth marriage , the not-quite being of true gentry status (unlike the Sima), the policies that came to be seen as not so gentry friendly.
Instead of one narrative that the Cao's could put a strong hold over (though the war with the Yuans showed they were more than capable of spinning a war), there were competing narratives to go against Cao Cao's apologia or contest that Xu was something more than brutal. Wu's well-furnished department and history works, Shu-Han with their poor records department, gave an alternative narrative of Cao Cao the wicked controller of the Han, Cao Cao the cruel. Works Yuan Shao/Chen Lin's Call of Arms survived as did the Wu based attack work Cao Man zhuan (something the novel was happy to borrow from), the executor of good men, untrustworthy and unrestrained.
Eastern Jin's Xi Zuochi would also use that failure to unite the land. That Cao Pi had no right to claim the throne as the land was not unified and attempting a ritual wasn't going to cut it thus the Han remained (via its Shu-Han representatives as blood relations) until Jin so it went Han-Shu Han-Jin, that Cao Pi's actions were an act similar to Wang Mang. This didn't gain traction at the time but Zhu Xi of the Southern Song would pick up the baton to argue Wei were not legitimate and be of great influence while Liu Yiqing's tales in the Shishuo Xinyu gave Cao Cao a mixed bag, clever, had a sense of humour, with an ability to tolerate things but not always kind and not always honest, arguably a villain. Xiao Chang and Hao Jing would both would point to Cao Cao's mistreatment of the Emperor and his executions of famed scholars, of taking authority by force vs the reluctant Liu Bei in a rather dodgy history but ones that gained their masters backing.
For some dynasties, advocating Liu Bei rather than Cao Cao was useful. Playing to the Han links was useful for Liu Yuan who paid sacrifice to Liu Bei and Liu Shan, for dynasties in the south fighting against bigger northern powers then you didn't want to be advocating for the northern Cao Cao but for Liu Bei. The legitimacy of the resistance of Shu-Han could be very useful, it wasn't pointless to keep fighting but it was righteous and loyal to fight as they had done, to maintain a dynasty against a cruel and illegitimate northern power. Represented by the Cao's.
There was also the question of why did Cao Cao fail to unite the land. They had the horses, they had the resources, the traditional heartlands, the manpower and in 208 Cao Cao was seemingly so close. Yet it didn't happen, heaven denied him the mandate and so it raised questions about his moral calibre if the heavens would deny him. When he passed, why did Cao Pi have the right to take over a throne when his family had not yet united the land? His failings and that of his descendants also reflected on moral calibre, that Heaven refused to grant them the mandate.
Perhaps if Wei had united the land, some of the issues would have been looked at in a different light. His treatment of Emperor Xian (ignoring plea to let him, executing family and friends of the Son of Heaven including sons), some of the more controversial executions like Kong Rong, Bian Rang and Yang Xiu, his background, might have been reflected in a different light as the founder of a unifying empire. He wasn't and these things became a problem for his reputation.
There was also the problem of popular feeling, one that had been pro Liu Bei. By the time the Romance of the Three Kingdoms was made, it wasn't just building upon legitimacy arguments by scholars of old but it took from centuries of plays and tales, incorporating them into a single narrative.
Liu Bei became the centre of popular tales by at least the Northern Song. He and his son were renowned for kindness (the novel rather skipped over that last one), Liu Bei had fought across the land, rising from a sandal weaver to an Emperor with connections to a long-lived dynasty having been a loyalist to said dynasty. The Han perhaps looking rather better in the centuries of chaos that followed the three kingdoms than during it. Not just Liu Bei but his friendship and bonds, as close as brothers, with the honourable Guan Yu who was soon worshipped in Jing and became a religious figure, the rough and ready Zhang Fei, both of whom got plays of their own. This band of brothers could be helped by Zhuge Liang, a man so popular he was worshipped in Yi after his death and in the plays become the traditional sage. Or sometimes by Yang Xiu.
Cao Cao, or a representative like Xu Chu, Zhang Liao, or Xiahou Dun, would often be the opponent. Whereas Liu Bei and co were the small guys, of poor background, Cao Cao and co represented the big power to be upset by the courage and heroism of the underdog. Cao Cao was of a rich family, descended from a eunuch, a man with not always a great reputation, representing power. The devious, arrogant and ambitious figure to lose to the true Han loyalists, outwitted and foiled by the heroes. A man of such different background, a man known for being crafty and ambitious, was not to be the hero for the public.
I would recommend chapter 11 of Imperial Warlord, A Biography of Cao Cao 155-220 AD by Rafe De Crespigny. The relevant chapter Another Life: History, Anecdote and Fiction discusses Cao Cao's changing reputation in the work of scholars and the popular imagination
I hope this helped