Everything depends on the country of transit. If you fly from Russia to the destination country and transfer in the destination country, then, of course, you can get off the airport and explore the city. But some other countries require for transit to the city to issue a transit visa, for example, in the US, Canada or Australia. Therefore, study the rules of transit in a country where you have a long transfer.