(this image appears for illustrative purposes only and no attempt is made to supersede any copyright attributed to it)
Mr Smith was a super-computer owned by Sarah Jane Smith who also served as one of her faithful allies. He was located in the attic of Sarah Jane's house at 13 Bannerman Road. It was revealed that he was actually a Xylok embedded into the computer. For a brief period of time, he was Sarah Jane's enemy.
The computer known as Mr Smith housed a sentient and highly intelligent crystal known as a Xylok. In the distant past a Xylok ship had crashed into the Earth, trapping the Xyloks in the crust of the planet. It is believed that that earth shock wiped out the dinosaurs, but it may be speculated that it was the Xyloks that did it. When the volcano Krakatoa erupted, one crystal escaped. Centuries later, Sarah Jane Smith retrieved the living crystal, took it to her home on 13 Bannerman Road, and found it could communicate with her via her laptop. The crystal informed her how to build the computer to house the living crystal. Sarah Jane did not know at this time about the Xyloks or that Mr Smith planned to free the other Xyloks, even at the cost of the planet itself.
After she created the computer to house him, Mr Smith helped Sarah Jane, and offered her knowledge on many things. His help at this point however, was mainly confined to hacking other computers and displaying information on alien life forms. He momentarily revealed his dark side to Clyde Langer, presumably because he realised he might get help from the Slitheen.
Eventually, Mr Smith was able to team up with members of the Slitheen family on Earth. He helped two of them pose as Luke Smith's true parents so that they could kidnap him. Alan Jackson used a computer virus against Mr Smith which disabled him and wiped his database. As a result, Mr Smith forgot his purpose and asked for instructions. Sarah Jane informed him that his mission was to save humanity, which he accepted and fulfilled thereafter.