The emotional controversy in West Germany over the legacy of SS soldiers erupted into violence today as 400 anti-Nazi activists laid siege to a hotel here, where several hundred veterans of the elite Waffen-SS are holding a reunion.

Chanting "Nazis out," the protesters pelted the hotel with bottles, paint bombs and eggs for more than an hour before police restored order by firing jets of water laced with tear gas into the crowd. Eight people, including four policemen, were injured and more than two dozen arrests were made, police said.

The attackers, described by police as "punks and anarchists," had assembled in front of the Hotel Krone as part of a peaceful demonstration of 5,000 people marching past to demand the expulsion of the Waffen-SS veterans from this small Alpine resort town.

Last Sunday's wreath-laying ceremony by President Reagan and Chancellor Helmet Kohl at the Bitburg military cemetery, where 49 SS troopers are buried, appears to have intensified the conflict between the SS veterans and those opposed to their reunions.

Several former SS soldiers here said they felt vindicated by Reagan's appearance at the cemetery because it demonstrated that they deserved the same respect as other soldiers.

"Reagan is the best president the United States ever had," said Walter Krueger, 72, a former Waffen-SS major in the 1st Panzer Corps. "It was always the fate of German people to suffer in war under weak and sickly presidents like Wilson and Roosevelt."

Noting that Germans and Americans are now allies, Krueger said that by going to Bitburg Reagan has "honored all soldiers and showed that we were just like the others."

Reunions of SS divisions are annual affairs in West Germany and traditionally attract protests. Today's protest, however, was far larger and more violent than previous gatherings.

The SS, or Schutzstaffel, founded in 1925 as Adolf Hitler's personal bodyguard, is blamed for the most barbarous Nazi crimes. The Waffen-SS divisions were elite wartime combat units that grew out of the notorious SS. Some Waffen-SS units were implicated in brutal acts in German-occupied territories on the eastern and western fronts.

The SS veterans claim their meetings are designed to bring together former wartime comrades and to help needy pensioners.

But Jewish and civil rights groups in West Germany have accused the veterans of seeking to perpetuate the Nazi mystique, citing the appearance of known members of neo-Nazi groups at some of the reunions. Police said today that about 20 members of the neo-Nazi "Viking youths" who had come to support the SS veterans were kicked out of town after scuffling with some anti-Nazi demonstrators.

Earlier this year, Nesselwang's town council sought to ban SS gatherings from taking place here but found that no legal action could be taken as long as the veterans held a private session and did not promote Nazi ideas.

The town council, led by conservative Mayor Oswald Kainz, ultimately passed a nonbinding resolution condemning the SS meetings. "We have distanced ourselves from the SS reunions, even though we have to allow them to go on because of their democratic rights," said Kainz. "But the peaceful demonstrators are much more welcome."

The hotel's owner, a former SS soldier named Rolf Bucheister, decided to host this weekend's reunion of the 1st Panzer Corps veterans when other resort sites refused to accept them. Last week Bucheister also received about 200 former members of the Waffen-SS "Death's Head" divisions, which have been accused of vicious wartime atrocities in Poland.

The two 1st Panzer Corps divisions, known as "Leibstandarte Adolf Hitler" and the "Hitler Youth," have been charged by war tribunals with conducting massacres against unarmed soldiers from the United States, Britain and France. The 1st Panzer Corps also has been charged with annihilating French civilians in the town of Oradour-sur-Glane.

One of Oradour's seven survivors, Camille Senon, urged a ban on further SS reunions in a speech to a rally here before the protest.