Is it illegal to swap boarding passes and fly to a different destination?

I imagine the police could get quite creative in charging you, because what you propose would represent a major security breach. Airport security depends on knowing the identity of everyone getting on each aircraft. It’s unlikely your approach would work, though:

In the US you’d fail the passport and boarding pass matching check by the gate agent at boarding — although this is manual, so somewhat error prone because they’re only human.

In Europe, many of the bigger airports (e.g. Heathrow) capture biometric data from cameras when you go through security and associate it with your boarding pass (which you have to scan). If your biometrics don’t match your boarding pass at the gate, you’re not getting on the plane. At smaller airports they just do the passport-boarding pass check.

At the other end, if you somehow managed to get on the plane, you would likely trip an immigration check: your name wouldn’t be on any arriving passenger list. You wouldn’t get into the country. This happened to a colleague on a flight to Paris once due to an error. The French authorities questioned him for several hours and then put him on a plane back to San Francisco.

You need a visa for Russia, it requires a letter of invitation. I’m not 100% but I think they also need your flight details. In any account of all the countries in the world you don’t want to enter illegally Russia would be high on my list.