Links to some scholarly analysis on the topic at the bottom
The first thing to understand when addressing this topic is that our political parties are not monolithic organizations with a single set of beliefs.
In some political systems there are many parties with more specific ideals, and in order to reach a majority to gain control it often requires two or more parties negotiating to form a coalition after an election.
In the US winner-take-all system, the coalitions are already pre-existing before election day. The two major parties are themselves huge coalitions of different voting blocks and interest groups that almost certainly don't all agree on everything.
So when we discuss the party shift/swap/realignment, the claim is not that everyone in both parties changed their minds about all the issues or immediately went out and changed their party registration.
The facts are that the existing voting coalitions of the early 20th century broke down over the course of the century and then reformed with certain blocks with opposing views having ended up swapped between them.
This is trivially easy for even the most casual observer to witness just from looking at the most narrow extremes. The KKK was initially formed by primarily Democratic party members, and had a lot of sway in Democrat-dominated southern politics after the Civil War. But in the current era, they (and similar groups) are some of the most reliably pro-Republican and anti-Democratic voices in the country.
In the larger picture, one of the major coalition changes that occurred was black voters gradually shifting towards the Democratic party (roughly 85-95% of black voters now vote Democrat in presidential elections), while southern rural white voters shifted to the Republican party over the same period. This is often simplified down to Johnson (a southern Democrat) signing the Civil Rights Act, and Nixon's opportunistic 'southern strategy' of dog-whistling economic policies that would disproportionately hurt African-Americans.
At the same time, the broader economic leanings of the two parties did not dramatically change (though between elections there have certainly been shifts on certain issues and the extents to which they lean one way or the other). But the Republicans traditionally leaned in favor of big business. The Democrats traditionally leaned more in favor of labor.
So the entire parties did not 'swap' per say, but there were large shifts in their coalitions that dramatically changed their overall party platforms on certain issues.
The common Republican retort to the realities of black voting patterns is usually that the now primarily Democrat voting African-Americans have been somehow 'trapped in a plantation mindset' and just don't know what is best for themselves, or something similarly infantilizing. But of course this is exactly the same sort of dehumanizing rhetoric dripping with racial superiority that the early 20th century Dixiecrats would have used to explain former slaves supporting Republicans after the Civil War.
Detailed analysis of gallup polling data from the mid 20th century
An analysis of election data from the beginning and ends of the 20th century