They didn't. It was the Americans.
Seymour Myron "Sy" Hersh has investigated and exposed How America took out the Nord Stream pipeline:
Last June, the Navy divers, operating under the cover of a widely publicized mid-summer NATO exercise known as BALTOPS 22, planted the remotely triggered explosives that, three months later, destroyed three of the four Nord Stream pipelines, according to a source with direct knowledge of the operational planning.
... Two of the pipelines, which were known collectively as Nord Stream 1, had been providing Germany and much of Western Europe with cheap Russian natural gas for more than a decade. A second pair of pipelines, called Nord Stream 2, had been built but were not yet operational ... President Biden and his foreign policy team ... had been vocal and consistent in their hostility to the two pipelines, which ran side by side for 750 miles under the Baltic Sea from two different ports in northeastern Russia near the Estonian border, passing close to the Danish island of Bornholm before ending in northern Germany.
... From its earliest days, Nord Stream 1 was seen by Washington and its anti-Russian NATO partners as a threat to western dominance.
For those casting aspersions on him, I can only add that his journalistic history - like reports on the Mỹ Lai Massacre cover-up in the Vietnam war (for which he won the Pulitzer award) or the Abu Ghraib and Guantanamo prison scandal where CIA sanctioned tortures - highlights his unbiased anti-establishment views when it comes to exposing wartime crimes or puncturing wartime propaganda. He is unbiased and has not spared either the Clintons or the Bush in his reports. (All this strongly indicates why he is in the NSA watchlist and why administrations fearful of criticism have tried to continuously discredit him).
Unless it's a political miscalculation by Putin's government, it isn't really in Russia's interest.
There are some good points that @o-m made in his answer. (He forgot to mention that it could also be a false-flag operation to generate doubts and sympathy for Russia from Europeans who are suspicious of the Americans and the British). An important thing to note though is that all the reasons highlighted only offer a temporary short-term political advantage to Russia.
In the long run, this is actually quite detrimental to Russia for the following reasons:
Economical Impact - Russia has made huge investment in creating energy infrastructure in Europe, and it's economy is quite dependent on selling oil and gas. Any competition and loss here has a negative impact on the Russian economy.
Loss of political goodwill: The more countries become hostile to Russia, the more isolated they become in the current world order. This leaves less room political and diplomatic manoeuvring in international affairs.
The current disruption allows its rivals to harm Russian interests and even gain over it (see Why does the U.S. oppose the Nord Stream 2 gas pipeline project?). Russia understands that losing EU as a client would be a huge blow for it both politically and economically. Note that Russia was, so far, the dominant source and supplier of natural gas to Europe for a long time.
In terms of "gas politics", there are two possible beneficiaries that derive long-term political and economic advantage - the United States and the EU.
How the United States stands to benefit
In late 1981, President Ronald Reagan opposed the construction of an early gas pipeline and imposed an embargo on sales by U.S. firms, arguing that the gas pipeline would make Western Europe too dependent on the Soviet Union. Reagan even approved a covert CIA effort to blow up part of the pipeline, which ended in only a modest construction delay. - Washington Post
The war in Ukraine and blowing up the pipeline works in favour of the US as it has rightly made EU jittery about their dependence on cheap Russian gas. The US, which has always been unhappy (for both economic and political reason) with EU buying Russian gas, has now found a big foothold to capture the EU market at the expense of Russia.
And it is a fact that the US is benefiting at the expense of Russia and EU. In fact, Europe accuses US of profiting from the war :
"The fact is, if you look at it soberly, the country that is most profiting from this war is the U.S. because they are selling more gas and at higher prices, and because they are selling more weapons," one senior official told POLITICO ... As they attempt to reduce their reliance on Russian energy, EU countries are turning to gas from the U.S. instead — but the price Europeans pay is almost four times as high as the same fuel costs in America ... French President Emmanuel Macron said high U.S. gas prices were not "friendly" and Germany's economy minister has called on Washington to show more “solidarity” and help reduce energy costs.
...The diplomat argued that a discount on gas prices could help us to "keep united our public opinions” and to negotiate with third countries on gas supplies. "It's not good, in terms of optics, to give the impression that your best ally is actually making huge profits out of your troubles," the diplomat said.
(And, as I pointed out before, they have been doing everything they can to sabotage Russia's Nord Stream 2.)
Professor Jeffrey D. Sachs in his testimony to the UN on the Nord Stream Pipeline destruction also highlighted that the political views from US politicians seemed to strongly suggest that the US (and allies) were behind the act, as otherwise they should have been outraged at what was an act of international terrorism instead of seemingly celebrating it:
... Senior US officials made statements before and after the Nord Stream destruction that showed the US animus towards the pipelines. On January 27, 2022, Under-Secretary of State Victoria Nuland tweeted, “If Russia invades Ukraine, one way or another, Nord Stream 2 will not move forward.” On February 7, 2022, President Biden said, “If Russia invades… again, then there will be longer Nord Stream 2. We will bring an end to it.” When asked by the reporter how he would do that, he responded, “I promise you we will be able to do it.”
On September 30, 2022 immediately following the terrorist attack on the pipeline, Secretary of State Antony Blinken declared that the destruction of the pipeline is “also a tremendous opportunity. It’s a tremendous opportunity to once and for all remove the dependence on Russian energy and thus to take away from Vladimir Putin the weaponisation of energy as a means of advancing his imperial designs.” On January 28, 2023, Under-Secretary Nuland declared to Senator Ted Cruz, “I am, and I think the administration is, very gratified to know that Nord Stream 2 is now, as you like to say, a hunk of metal at the bottom of the sea.”
Such language is not at all appropriate in the face of international terrorism. I hope that the US together with all other Security Council members will condemn this heinous act of international terrorism and join together in an urgent UNSC-led investigation of this international crime in order to determine the truth. The truth is not yet known by the world, but it is knowable.
His views do lend credence to the suggestion that the US did consider the pipelines to be a legitimate military target, and hence attacked it. Especially when you also consider that the US media tried to shut him down when he tried to air the same views publicly in an interview.
How the EU stands to benefit
"We are trying to wean ourselves off Russian gas," the policymaker said. "When the time comes in 2028, 2029, 2030, and Russia decides to close us out, we can be like, 'Fine.'"
Without diversification EU has to be dependent on Russia, which isn't politically desirable due to their past conflicts and EU's alliance with the US and UK (NATO). But the problem EU faces is that Russian gas is really, really cheap. This makes it difficult for EU countries to buy gas from other sources as it would be an economically unpopular decision with their voters.
Any fix to a total, immediate split from Russia would require sacrifice across the continent — something that would be painful for European politicians who are wary of infuriating their voters.
"It takes time to build out renewables and to electrify heating and diversify fuels for heavy industry," Bordoff said. "And it takes time to build infrastructure needed to pull natural gas from world markets. Russia is still the cheapest gas into Europe. So you have to be willing to pay a premium" for more expensive liquefied natural gas.
Note that countries in the EU offer energy (gas or electricity generated with gas) to their citizens at a subsidised rate, clearly indicating how sensitive the consumer is to the price. This is a huge political hurdle to diversification as all the other sources are costlier than Russian gas, which means either the government will have to spend more on subsidy or pass on the cost to the consumer - both of which can anger voters.
The Ukraine war and the disruption of the Nord pipeline creates a political climate of fear and uncertainty with the Europeans that presents a good political opportunity to push for diversification to the public. While Russian gas still remains cheap, the current public hostility to Russia allows EU politicians to develop alternate infrastructure in the hopes that it may make gas from other sources cheaper and competitive enough to eschew Russian gas if necessary.
... The alternatives to Russian gas are complicated and will take time. Even facilities for liquefied natural gas exports to Europe need several years to expand. Gas suppliers need to build more capacity to cool it to the ultralow temperatures that allow it to be transported by specialized seagoing tankers. Europe needs to build more plants to warm the gas so that it can be sent through pipelines. Another alternative, nuclear, also has a complicated future in Europe, with long building times and some countries opposed.
Source: E.U. will unveil a strategy to break free from Russian gas, after decades of dependence
"The fact is that U.S. LNG, if priced competitively, can play and increasing role in EU gas supply, enhancing diversification and EU energy security," the EU said in a document detailing the state of EU-U.S. LNG trade in late November ... Showing the extent of much of the EU’s reliance on Russian gas, the Commission noted that 11 member states (Bulgaria, Czech Republic, Estonia, Latvia, Hungary, Austria, Poland, Romania, Slovenia, Slovakia and Finland) imported more than 75 percent of total national imports of natural gas from Russia in 2018, largely due to their proximity to the country ... there are other reasons to increase imports from the U.S. right now, including having a diversity of supply source and pricing ...
Source: Europe is fast-becoming a natural gas battleground for Russia and the US
Note though this doesn't mean that EU will stop buying Russian gas. They would be stupid to do so when the whole point is diversification of supply sources to reduce political pressure from one source, and to increase competition that helps in reducing prices.
Ultimately, analysts say, a partial transition from Russian energy may be all that is necessary — and a goal that is in reach. "Europe doesn’t have to completely eliminate its dependence on Russian gas. It just has to neutralize its potency as a point of leverage," Ladislaw said. "It takes a lot of work to back out a fuel like gas, and Europe has been well on its way to doing this over the last five years. It just needs to do more now."
Source: E.U. will unveil a strategy to break free from Russian gas, after decades of dependence