The concept of socialized medicine has been in political consideration in the United States since at least the 1930s, when it was proposed as a part of Social Security. The latter passed in 1935, while the former was abandoned. Two primary differences separated the two: firstly, the fact that social security targeted elderly populations, an attractive demographic due to voting habits; and secondly, the degree of opposition among business groups to socialized medicine.^1
As such, a good place to start this discussion would be to examine more closely the reasons why the AMA and physicians initially opposed Medicare and other forms of socialized healthcare. In 1956, for example, the AMA issued a statement before Congress delineating four primary justifications:
that there was "no need for the establishment of medical care as a fifth and separate category of Federal aid in public assistance programs."^2
that federal influence in medicine "would burden the community with regulations and restrictions inconsistent with local problems, local laws, or local customs." As an example, they cite the Social Security Act of 1952, which allegedly gave optometrists the ability to diagnose eye diseases where previously prohibited by state licensure boards.^2
that socialized medicine was "totally inconsistent with the philosophy heretofore underlying Federal participation in public assistance programs... that Federal participation in such programs is a temporary expedient." They believed that federal programs such as Social Security were intended only as a temporary measure, and that local assistance programs were intended to take over. Medicare would drastically increase federal influence.^2
that even limited forms of socialized healthcare were "only a forerunner to the injection of medical care as a categorical benefit under old age and survivors insurance," followed by rhetoric on how medical insurance was opposed by the American people and would destroy the healthcare system.^2
The 4th point is notable as, in the 1930s, the AMA was opposed to any form of health insurance entirely, stating that "no third party must be permitted to come between the patient and his physician." This perspective consequently applied to government health insurance options, and the AMA has consistently feared that Medicare or similar programs would prevent physicians using their own judgement.^3
Another reason for the AMA's opposition to socialized healthcare - perhaps a more demeaning one - may have stemmed from economic abuse. Medicine in the pre-Medicare era has been dubbed a "Golden Age" due to its profitability at the time. Physicians engaged in referral kickbacks, "ghost" surgeries (i.e. secretly contracted out), and excessive unnecessary procedures such as "appendectomies for stomachaches and hysterectomies on young women with nothing more than back pain." The difficulty of a layperson assessing the quality and necessity of medical care meant that there was little medical oversight - oversight which would be later provided, in part, by Medicare disallowing "any costs unnecessary to the efficient provision of care" in 1972.
Notably, the AMA itself made attempts to curb these less-than-honorable intentions, bluntly stating in 1955 that physicians "think about money a lot – about how to increase their incomes, about the cost of running their offices, about what their colleagues in other specialties make, about what plumbers make for house calls and what a liquor dealer’s net is compared to their own."^3
A general public distrust of doctors,^3 combined with wary support of expanded government healthcare by (mostly Democrat) presidents and members of Congress, began to wear down public opposition to socialized healthcare. In 1961, only days after his inauguration, President Kennedy sent a bill to Congress for federal medical insurance for the elderly (for the first time referred to by the name "Medicare"). However, Medicare still would not find purchase until further social upheaval. In 1963, JFK is assassinated. His Vice President, Lyndon B. Johnson, vows to deliver on JFK's "New Frontier" initiatives, including Medicare. And in 1965, LBJ wins the Presidential election outright with 61% of the popular vote, to date the largest vote share in US history since the days of Thomas Jefferson. Proponents of Medicare even found support from former opponents like Representative Wilbur Mills (D, AR), who until LBJ's landslide victory believed subjects like Medicare too controversial to touch. Despite their significant political influence, the AMA found it impossible to impede the progress of Medicare, which was finally passed in 1965. Interestingly, Medicaid snuck in on the same bill practically unnoticed, in part due to the kerfuffle over Medicare.^1
In the time since 1965, the AMA and similar professional groups have continued to maintain a degree of opposition to socialized healthcare proposals. Indeed, although OP's question indicates that groups like the AMA are the biggest proponents today, the AMA remain consistently opposed to single payer healthcare proposals and, until 2019, were party to one of the largest American coalitions against Medicare For All. That being said, there is truth to the fact that an ideological shift has taken place. Within medical practitioners, that shift may stem from the increasing recognition that medicine incorporates social concerns, from medical disparities between social groups to the influence of a medical practitioner's sheer presence on the local community. There is also seen a transition in self-image in the medical field from the doctor as innovator to the doctor as healer.^4
Of course, I must also clarify that part of the major ideological shift must be associated with evolving public perspectives related to communism and socialism throughout the Cold War era. I, however, am woefully unequipped to address that subject and will leave it to someone with expertise.