Russia is under U.S. sanctions. How does Russia have so much foreign exchange reserves?
russia uses its oil revenue to setup russia stabilization fund in 2004. The money in that fund is used to pay for national budget deficit. The foreign exchange reserve of Bank of Russia is not affected by the US led sanctions.
Russia has been ramping up its production of oil since late 1990s after it defaulted on its debt. It has been maintaining positive trade balance since then.
Also, notice in the above graph, Russia has had current account surplus for a long time. It is somewhat similar to saying that Russia has been a net lender to the rest of the world. The current account surplus has increased Russia's net foreign assets, this situation puts Russia among the top countries with the highest foreign reserves.
Also, the sanctions did not target oil and gas industry as much as the financial, agriculture, weapons and other industries.