The Soviet Union has built and tested a nuclear-powered attack submarine that can go faster and dive deeper than any U.S. Navy sub, government sources said yesterday.

The hull is built of titanium, sources said, and the nuclear power plant appears to produce more horsepower for each pound of weight than American counterparts.

"It's embarrasing the they've been able to do something we haven't been able to do," said one official. "And there's a big flap over it."

What the Soviets have done, according to secret data being reviewed with consternation by Navy officials, is build an attack sub that can steam 40 knots while submerged and dive to a depth of 2,000 feet or more.

This is considerably faster and deeper than the Navy's newest attack submarine, the Los Angeles. Its speed is believed less than 35 knots, and its diving limit hundreds of feet less than 2,000.

Congressional military committees are likely to demand to know how the Soviets have achieved such performance with a nuclear attack sub after the U.S. Navy had opened up such a big lead.

While the finger-pointing already has started within the Navy about the technical implications, it is still too early to tell whether the speedier Soviet sub would represent a fatal difference in a war.

The reason for this uncertainty is that the key to surviving in the depths is to hide from the hunters, whether they be other submarines, surface ships or antisubmarine planes. And the hunters all depend on the noise a submarine generates to find and kill it.

Soviet submarines, including this 40-knot one, are noisier than American submarines. Navy leaders therefore could contend that the Soviets' high-speed sub is a technical gimmick rather than a threat to American superiority under the seas.

However, the fresh evidence about Soviet submarine progress comes at the same time there is growing doubt within the Navy and Congress about the wisdom of sticking with the Trident missile submarine and the Los Angeles attack boat, underwater giants championed by Adm. H.G. Rickover.

Sources said the Soviets, in building the 40-knot sub, broke the habit of copying American models and ventured into bold engineering in both the hull and power plant.

Titanium, which provides more strength per pound than the steel used for the hulls of American submarines, is being cited as one reason the Soviets have been able to take an attack sub to record depths, perhaps as deep as 3,000 feet.

Titanium, by reducing the total weight of the submarine, also is credited with making the sub faster.

But sources said this is only part of the explanation for the sub's speed. The Soviets, they said, also seem to have found a way to obtain more horsepower from their nuclear power plants than the Navy is getting out of the same weight of machinery.

The Navy has been tight-lipped about the Soviet 40-knot sub, partly because its achievements are highly embarassing to Navy technical leaders and partly because the information about it was obtained by highly secret means.

The United States clocked the highspeed test runs of the Soviet sub over the last several years, before a new Navy study of alternatives to the Trident and Los Angeles was undertaken.

The initial reports about the sub going 40 knots were met with skepticism in the intelligence community. But now, on the basis of detailed intelligence data obtained during the sub's recent test runs, the 40-knot speed is generally accepted within the Navy.

Presumably, U.S. photographic satellites, which look down on the Soviet Union and use zoom lenses on such key military facilities as shipyards, tipped off the intelligence community that titanium was being used for what turned out to be a high-speed sub.

Sources said yesterday that the jury is now in. "Something down there is going awfully fast," one official said. One source said the sub was an Alpha, which is a sub of about 3,500 tons, completed in 1970. It could turn out to be a one-of-a-kind experimental sub.

There is a growing conviction among Navy leaders that the $1.5 billion Trident missile sub and the $500 million Los Angeles attack boat equate to driving to the poor house in Cadillacs. Navy Secretary W. Graham Claytor directed a Navy panel to take a fresh look at alternatives.

The panel concluded that smaller submarines costing 20 to 30 percent less to build than the Trident and Los Angeles could perform their combat missions without significant compromise.