Q:

Why did the X-15 not achieve orbit?

The X-15 has a maximum velocity of 7.274 km/s.  As the velocity to achieve orbit is 8 km/s, why did they not fly horizontal/diagonal until they achieved around  7km/s and then go vertical to get to space and reach orbit?

A:

You're confusing units. The maximum speed of the X-15 was 7274 km/h, or about 2 km/s. Orbital speed is around 8 km/s. The X-15 didn't carry enough fuel to reach orbital speed. 

A:

The X-15 didn't have the capability to get to orbit, and it was never intended to. the X-15's purpose was not space flight but to test aerodynamic heating at high altitude and high speed. It's skin was designed to tolerate a great deal of heat, but nowhere near what would be required for re-entry from orbital velocity. If it went to orbit it would burn up on return. 

A:

The X-15 was undoubtedly fast enough to reach altitudes at which the pilot could have looked into the blackness of the heavens, but high altitudes are not enough for achieving an orbital trajectory.  I know this doesn't exactly answer your question (and others have already explained the difference in units), but there's also a misunderstanding about achieving orbit.  Let's assume the X-15 did have the juice to make it into orbit.  As it climbed, it wouldn't go vertical; rather, it needs to flatten out and make its velocity more and more parallel with the earth's surface below it.  Going vertical would have actually guaranteed that it wouldn't go into orbit.
This is a very common misconception about things in high orbit.  Satellites, for example, have the appearance of simply floating at a certain distance from the earth, when in actuality, all of them are in free fall.  Yes, you read that right.  They are always falling.  How, then, do they maintain their distance from the earth?
Let's use a hypothetical example (with a healthy serving of exaggeration).  Let's say you can jump with extraordinary force, such that you can jump many miles away.  Of course, you can also jump just a few feet, when you like.  If you were to draw the path of a small jump on a large circle, which represents the earth, then you'd have small arc that goes up and then down very quickly.  Let's jump farther -- say, a quarter of the way around the earth -- and draw that arc.  The arc is longer, of course, and now it's becoming more obvious that the shape of the earth (its roundness) is influencing how far you can jump and how long you're staying in the air.  Truly, you're jumping part way around the earth every time you jump.
Let's jump really far -- halfway around the earth.  What it will take is a lot more force giving you a lot more speed.  When you draw that arc, it's now very clear that you are, indeed, jumping around the earth.  And what was the ground doing, below your feet?  The circle of the earth was, in a sense, "moving away" from you, was it not?  When you land, you're actually standing upside down relative to your position when you first jumped.
What will it take to jump so fast that you go all the way around the earth once and land back where you started?  This is something you can actually calculate, although I'll leave that to you.  Looking at your arcs, though, and considering what you know about jumping (that you're always falling), what matters for longer jumps is more speed (assuming you always jump at an ideal angle).  When you jumped halfway around the earth, weren't you still falling the whole time?  You just jumped with enough force so that you could go farther before you landed again.
Now the clincher.  Is it possible to jump so fast that, as you fall, the circle of the earth moves away from your feet as fast as you fall towards it?  You'd never stop falling.  I hope that helps explain why going vertical is what you don't want to do for achieving orbit.  For fun, consider if you were in the space shuttle and you wanted to come back down to earth, what do you have to do?  You can also now explain why, in the movies, they say that going too fast will make you "bounce off the atmosphere."  It's just a cheap way of saying that the speed will send the craft into an elliptical orbit, but that's not nearly as fun as bouncing.

This isn't a dead-on accurate description, of course.  It would take careful planning to achieve a circular orbit, even if you had the right speed, because you could easily go into an elliptical orbit and even crash back into the earth if your angle was wrong.

