Switched is the wrong word. Slowly evolved would be better wording. Both Parties changed and the country changed. It is a complicated story. No 'switch' occurred.
Where is socialism working? Seattle, everyone including Amazon are leaving. NYC, everyone is leaving. CA, everyone is leaving. They are going to TN, NC, FL places that encourage business with low taxes. Where is socialism working? No where.
Not simple at all. It happened over several decades. Generations died out. New values, new ideas. Side note, black folks mostly voted Republican until the FDR. That is a story in itself. Cheesy, maybe avoid history. I think It's too complicated for you.