The Axons land on Earth, desperately in need of fuel. They propose to exchange the miracle substance they call Axonite for some much needed energy. Axonite is a "thinking" molecule that can replicate any substance... or so they claim. As it turns out, the ship is a single organism called Axos whose purpose is to feed itself by draining all energy through the Axonite (which is just a part of itself), including the energy of every life form on Earth. The deception about the Axonite's beneficial properties was to facilitate the distribution of Axonite across the globe.
Meanwhile, the Master, who was captured by Axos and used his knowledge of Earth as a bargaining chip for his life and freedom, escapes Axos and makes his way to the Doctor's TARDIS — his own having been seized by Axos. He plans to repair it to escape from Earth.
Axos itself becomes interested in the Doctor's knowledge of time travel. It now plans to broaden its feeding base by travelling through time as well as space. The Doctor, realising this, plans to trick Axos into linking up its drive unit to his TARDIS so that he can send Axos into a perpetual time loop. After tricking the Master into completing the repairs on his TARDIS, the Doctor does just that. This results in every part of Axos dematerialising from Earth, including the Axon automatons and the Axonite.
At the end, with the Master having escaped in his own TARDIS during the confusion aboard Axos, the Doctor returns to Earth, but not of his own volition. Apparently, the Time Lords have programmed the TARDIS to always return to Earth, like some "galactic yo-yo".