Alaska was sold in 1867. The Soviet Union didn’t exist at that time.
Russia decided to get sell Alaska after the Crimean War (1853—1856) in which Russia and Great Britain were enemies and Russia lost. Emperor Alexander II realized he would not be able to properly protect such a far away land in case of a major war. So, Russia sold Alaska to the US.
As for Canada, in 1867 it wasn’t an independent country, it belonged to the British Crown. Naturally, Russia didn’t want its main rival of the time to own this land.
Below is the USD 7.2 million check issued by the American Government to the Russian Empire. Back in the 1860s you could buy a building in Manhattan for roughly the same price.