In the 1800s, Democrats were pro-slavery and Republicans were anti-slavery. Now, Democrats have liberal ideologies and Republicans are conservative. When, why, and how did that happen?
There's always more to be said (not by me, I don't know anything), but you may find u/Samuel_Gompers response in this thread from a few years ago enlightening: