Andrei Gromyko, 75, who served as Soviet foreign minister for the past 28 years, was elected president of the Soviet Union today, becoming titular head of state.

In a surprise move, the veteran diplomat was replaced by Eduard Shevardnadze, 57, the Communist leader of the southern Soviet republic of Georgia, who has no diplomatic experience. Shevardnadze was promoted to full membership in the ruling Politburo only yesterday.

The opening session of the Supreme Soviet (legislature) formally voted for the changes presented by the party leadership. They underscored Mikhail Gorbachev's unquestioned authority as Soviet leader.

Both foreign and Soviet analysts here said the developments today foreshadowed a shift in Soviet foreign policy away from the concept of a "bipolar world" in which Soviet-American relations were assigned the pivotal place.

After Gorbachev assumed power in March, there was a great deal of talk in well-informed Soviet circles that the 54-year-old Gorbachev was aiming to play down slightly the importance of Soviet-American relations and assign a greater importance to Moscow's relations with Western Europe, Japan, China and other parts of the world.

It is unclear whether this line of thinking was precipitated by the Kremlin's continued frustration with President Reagan's military policy or by Gorbachev's desire to seek new foreign policy approaches, or by a combination of the two.

The departure of Gromyko from the Foreign Ministry had been expected. His election to the presidency, a prestigious but highly honorific position, seems to be an elegant way of capping the extraordinary career of a man who rose from the role of self-effacing executor of foreign policy to become its chief architect during the past decade.

His departure marks the end of an era. The fact that Shevardnadze was made a full Politburo member before being appointed foreign minister clearly indicated that he will be Gorbachev's foreign policy manager.

An impression was created here that Gromyko's appointment to the presidency was linked to his recent policy approaches.

Although he remains a popular figure in the party, Gromyko is criticized covertly for the failure of his policy of seeking accommodation with the United States, and particularly of his moves that led to the reopening of the Geneva arms talks.

Authoritative Soviet sources said today that the utility of the Geneva talks is being questioned increasingly here and Gorbachev indicated publicly last week that the talks may collapse if Reagan continues his Strategic Defense Initiative, also known as Star Wars. It is unlikely, however, that the Soviets would take any action to scuttle the talks until after a Reagan-Gorbachev summit, which now is scheduled for November.

The sources insisted that intelligence reports made it clear that the United States was secretly engaged in the development and testing of space-based antiballisitc missile systems.

Moreover, the sources insisted that the construction of large U.S. Air Force "Pave Paw" radar stations in the southern United States and in Greenland "is creating the basis" for the establishment of a major antimissile defense system, which would destroy the 1972 Antiballistic Missile Treaty. The ABM treaty is regarded as the essential basis for all Soviet-American arms agreements.

A special group of Soviet space and military experts concluded recently that "the degree of risk is prohibitively high" that the arms race would take an uncontrollable course.

Against this background, the appointment of Shevardnadze is seen as symbolizing an evolution of Soviet thinking under Gorbachev. According to this thinking, the Foreign Ministry under Gromyko has been controlled by the so-called "American Mafia," which has a fixation on the United States.

There was, however, not a whiff of criticism when Gorbachev proposed Gromyko for the presidency, praising him as an "eminent politician, one of the oldest members of the party" and a man of "great experience and deep knowledge." Western diplomats here speculated that the elevation today also reflected Gorbachev's political debt to Gromyko, who gave him strong support for the leadership following the death of Konstantin Chernenko.

Gromyko, in a brief speech, professed to be deeply moved by the decision and pledged to "make every effort to fulfill honorably my duty toward my party and country." Officials close to Gromyko described him as being very pleased by the appointment.

As president, or chairman of the Presidium of the Supreme Soviet, Gromyko will represent his country in dealing with foreign heads of state.

In practice, however, the general secretary of the Communist Party is the country's leader in both domestic and foreign affairs. The Supreme Soviet today elected Gorbachev a member of its Presidium, a post that gives him the formal authority to deal with foreign heads of states when he chooses to do so.

Gorbachev's three immediate predecessors also have held the title of president. In explaining the departure from this practice, Gorbachev said that the Soviet Union "is living through a responsible period" when the new leadership is planning changes in the economy and society. For this reason, he continued, as general secretary he wanted to "concentrate to the maximum" on domestic economic and political issues.

Gorbachev appointed his own foreign minister one day after removing from the leadership Grigori Romanov, one of the senior Politburo members, who was long regarded as Gorbachev's main rival. Romanov, 62, was said to have failed to attend the Central Committee plenum that removed him from office yesterday.

The selection of Shevardnadze to replace Gromyko as foreign minister was unexpected. For more than a week there were rumors here that a Politburo member would be chosen to replace Gromyko, and most knowledgeable Soviet officials expected that the job would be given to Vitali Vorotnikov, 57, who served as ambassador to Cuba.

Shevardnadze is known to be an efficient executive and a good public speaker. A native of Georgia, he is said to be easygoing and affable. He is the first Georgian since the death of Joseph Stalin to become a full member of the Politburo and to hold a high office in Moscow.

The Supreme Soviet also appointed another Gorbachev ally, Politburo member Yegor Ligachev, chairman of the parliamentary Foreign Affairs Committee, a post traditionally held by the party's second secretary, or the number two man in the party hierarchy.