Vision was originally created to be Ultron's next body by a mind controlled Helen Cho from synthetic tissue and vibranium. Knowing the body would make Ultron unstoppable, the Avengers stole it while Ultron was halfway through downloading his program to the body.
Taken back to their headquarters Tony Stark and Bruce Banner, behind the backs of their teammates, began to upload the remnants of J.A.R.V.I.S- who had been fractured and nearly destroyed when Ultron was originally activated- into the android's mind so that he could assist them in defeating Ultron. Captain America confronted them, but the argument was interrupted when Pietro Maximoff simply raced around and unplugged the system. Thor was next to arrive on the scene, crashing down into the building and bathing the android body in an intense lightning discharge. The android arose from its cradle and threw Thor aside, but then stopped itself in mid-air and looked out the window. As he calmed down and descended to the ground, Thor told the others that the android had appeared in a "vision" and the gem in its brow was one of the Infinity Stones. As the team questioned Vision (his now adopted name) on his motivations, he told them that he was on the side of life and that he didn't want to destroy Ultron because Ultron was unique and in pain, but he also chose to side with the Avengers knowing that Ultron sought to end all life. Although Vision noted that he knew that the Avengers could not be certain of his intentions given his origins, he unintentionally proved that they could trust him when he casually handed Mjolnirto Thor, something that none of the Avengers had been able to do.