Tokyo became Japan's capital in 1869, after the end of the Boshin war, in which the Tokugawa Shogunate was defeated and direct Imperial rule restored. Edo, as it was known before, was then renamed to Tokyo ("Eastern Capital") and became the new capital.
However, while Kyoto had been the official Japanese capital for more than a millennium, actual political power had been concentrated in Edo for several hundred years (since the early 17th century) before its official declaration as capital. As the Shogunate's main residence, all important political decisions were made in Edo. I assume (I don't have a source at hand for this assumption) that this, coupled with the fact that Tokyo was a much larger and much more economically important city than Kyoto, was the main reason that the capital was moved there: the capital was moved, the but the actual seat of power stayed where it had been for more than 250 years.
For general questions about Japanese history starting around the time of the Meiji restoration, I can suggest "Japan: a Modern History" by James McClain. I can't remember any details (it must've been at least a decade since I read it), but I remember it being a very accessible and quite comprehensive overview on the topic.