The Elemental

A nameless elemental being first appeared in the Fifth Doctor's life as a mysterious presence aboard an abandoned spacecraft. Subsequently, it possessed and used the Doctor's TARDIS for its own purposes.

The Doctor and his hapless passenger, Maxwell Edison, found a derelict alien ship approaching Earth. Edison sensed a presence. The Doctor believed they had seen the last of it. (COMIC: Stars Fell on Stockbridge)

Actually, the entity held onto the TARDIS and, after Maxwell had left, directly attacked the Doctor and took full control of the TARDIS. The TARDIS shook off the presence and stranded it some time in Earth's distant past, where savage tribes worshipped it. The Time Lords of Gallifrey, in particular Tubal Cain, took notice and held the Doctor responsible for negligently allowing the being to interfere with history. Shayde, an ally of the Doctor's, forced the elemental into the Matrix, where it could exercise its whims without doing harm in the physical universe. (COMIC: The Stockbridge Horror)

Behind the scenes
The being, as shown in the stories, does not have a name or a consistent personality. Some narration strongly implies it has an affinity for technology while other descriptions indicate that it simply exists in the form of energy. Descriptions of its intelligence and malignity vary as well.