This article explains it pretty well:
https://nypost.com/2015/05/31/how-ty-cobb-was-framed-as-a-racist/
TL;DR: He was a hothead who fought a lot of people, including blacks (fighting was a lot more common back then) and was from the South so he was labeled a racist. But he wasn't even really known as a racist until his biographer sensationalized everything to sell more books. Cobb was going to sue him but died before he could do so.