They don't really spend a lot of time explaining this in the movie, you have to piece it together from various bits of dialog during that scene (and others later on). But, Ultron isn't "in" the scepter, rather, the scepter contains the last piece of technology Stark and Banner needed to finish building the Ultron project.
Given that Banner was already familiar with Ultron at the very beginning, we can assume that it was the name of a project that Stark and Banner had been working on. Presumably, some form of AI that would be self-aware enough to defend Earth against previously unknown threats (particularly alien ones). Much of the work in building that was apparently in place. When JARVIS examined the scepter, it saw that there was something inside, that it interpreted as "code" to some new, advanced operating system. However, while JARVIS's OS is clearly artificial and digital, the "code" inside the scepter looked much more organic and fluid, like you might imagine a "biologically-based" computer might look.
Tony believed that he could adapt the code from within the scepter and somehow modify it to interface with the existing Ultron project. As it turns out, the "thing" inside the scepter was actually the Mind Stone, which is an object far more advanced and powerful than any Earth-based technology. So, when Tony attempted to harness that power and, essentially, plug it in to his existing technology, it rapidly took over. The combination of all those things -- the Mind Stone's power, the Stark hardware, and the existing "save the world" protocols that Tony had already built into the Ultron project, all combined to make the entity known as Ultron.
Exactly why there is computer code inside an millions-of-years-old magical artifact from the beginning of creation isn't really explained, much less how JARVIS and Tony recognize it as an operating system. If I had to speculate, I'd suspect that it was merely the way the Mind Stone chose to expose itself to Tony, in a form that it knew he would recognize. We know the Mind Stone is immensely powerful, particularly with mental abilities -- it made Strucker smarter just being around it -- so probing Tony's brain to figure out some form that would allow him to understand and use it's power would be trivial for it.