So why horizontally? Imagine there was no air resistance on Earth. If you shot a bullet that bullet would keep going until the force of gravity pulled it down and it hit the Earth. But now imagine that you shoot it fast enough that the vertical distance gravity is pulling it down is less than the vertical distance it gains due to the curvature of the Earth. That equilibrium is exactly what orbit is. It also leads to the highly counter intuitive fact that the height of a given circular orbit is determined exclusively by how fast an object is moving relative to the body it's orbiting. Mass doesn't matter.
Okay so back to the plane. If it's not intuitive yet imagine throwing a ball. It works exactly the same as our bullet, but we can visualize one important part easier. The ball's trajectory will be a parabola. And at the highest point of that parabola the net vertical force on the ball is zero. It's where the force you exerted on it to send it up, and the force of gravity pulling it down eventually reach an equilibrium. Something inside of that ball would experience 0g at the moment when it was at its parabolic peak. And that's exactly what these planes do. They simply 'throw' the planes into a parabolic path, and the passengers experience near 0 g while traveling through the parabolic peak.