There were three hordes: the Blue Horde, located near Tyumen; the White Horde, located near Omsk; and the Golden Horde, located in the Volga region. Tokhtamysh was the khan of the Blue Horde, but since there was no legitimate Chinggisid heir left in the Golden Horde, and power had been usurped by the temnik Mamai, he marched against the Golden Horde. And the Russian princes supported the legitimate khan against the usurper.
The fact that Tokhtamysh later ravaged Moscow was simply because he couldn't imagine that one prince (from Ryazan) would tell lies about another (from Moscow). He simply believed the princes of Ryazan, who said that Dmitry was seeking an alliance with Lithuania and decided to prevent this.
Auto-translated