Ball thrown from a moving train

Let me first go through this without friction or air drag.

You say $v_y$ along the $x$-axis and the train moves with $v_x$ along the $z$-axis. This is a little inconsistent. I will use the velocities, but not your description of the axes. So the train moves in the $x$-direction, the ball is thrown into the $y$-direction and it the $z$-direction is up-down.

From the train

From the observer in the train, the ball will move with a constant $v_y$ away from the train. There is nothing that slows it down. Also, there is no $v_x$ component in the motion of the ball relative to the train. So the man on the train will see the ball right in front of him, flying further away and starting to fall down with $v_z = - g t$. There will be a curved trajectory, a parabola in the $y$-$z$-plane, the plane where the train is moving perpendicularly to.

That looks like this:

enter image description here

You can write this with vectors like so, with $g$ being the acceleration due to gravity: $$ \vec v(t) = v_y \, \hat y - g t \, \hat z = \begin{pmatrix} 0 \\ v_y \\ - gt \end{pmatrix} $$

Then you can integrate this again with respect to $t$ and get the position $\vec r$ of your ball. I set all integration constants to 0 to make this simpler. In principle, they allow for any starting point. I'll just assume that the starting point is the origin of the coordinate system. So the trajectory is: $$ \vec r(t) = v_y t \, \hat y - \frac12 g t^2 \, \hat z = \begin{pmatrix} 0 \\ v_y t \\ - 0.5 gt^2 \end{pmatrix} $$

From the ground

If you are an observer such that the train is moving with respect to you, you will see the ball moving with a constant velocity in $x$ and $y$, but also seeing it start to fall down. So you see a parabola in a plane that is crosswise to the axes.

I made another picture, you are looking at the front of the train, just a little skewed to see the 3D axes:

enter image description here

The velocities are similar, except that you have to include the motion of the train as well. The ball has the same $v_x$ as the train has. So this is $$ \vec v(t) = v_x \, \hat x + v_y \, \hat y - g t \, \hat z = \begin{pmatrix} v_x \\ v_y \\ - gt \end{pmatrix} $$

After integration, this is: $$ \vec r(t) = v_x t \, \hat x + v_y t \, \hat y - \frac12 g t^2 \, \hat z = \begin{pmatrix} v_x t \\ v_y t \\ - 0.5 gt^2 \end{pmatrix} $$

Galilei transformation

Alternatively, you could apply a Galilei transformation to it. I will try to be pedantic since transformations from coordinate systems are hard to get right. I just have done months of general relativity, so I know how hard this is :-)

Let the system of the train be system $\Sigma$ where the coordinates are $\vec r$ and $\vec v$. The system on the ground shall be $\tilde \Sigma$ where the coordinates are $\tilde{\vec r}$ and $\tilde{\vec v}$.

So we already had the following for the train (without $\tilde{}$): $$ \vec r(t) = v_y t \, \hat y - \frac12 g t^2 \, \hat z = \begin{pmatrix} 0 \\ v_y t \\ - 0.5 gt^2 \end{pmatrix} $$

Now the transformation from the train to the ground goes like the following: $v_x \to \tilde v_x = v_x + v_\text{Train}$. All other velocities are unchanged. When this is integrated, the space points will be transformed with $r_x \to \tilde r_x = r_x + v_\text{Train} t$.

With that transformation, we can get the trajectory viewed from $\tilde\Sigma$, the ground: $$ \tilde{\vec r}(t) = \underbrace{\begin{pmatrix} 0 \\ v_y t \\ - 0.5 gt^2 \end{pmatrix}}_{\vec r(t)} + \begin{pmatrix} v_\text{Train} t \\ 0 \\ 0 \end{pmatrix} $$

You said that the train was moving with $v_x$, so we can write $v_\text{Train} = v_x$ and get $$ \tilde{\vec r}(t) = \underbrace{\begin{pmatrix} 0 \\ v_y t \\ - 0.5 gt^2 \end{pmatrix}}_{\vec r(t)} + \begin{pmatrix} v_x t \\ 0 \\ 0 \end{pmatrix} = \begin{pmatrix} v_x t \\ v_y t \\ - 0.5 gt^2 \end{pmatrix} $$ which we had earlier already.

Air drag

Air drag will cause the ball to slow down in each of its velocities, bending the curve even more.

Picture from above

If you look from above, this is the same as ignoring gravity. It looks like this:

enter image description here

Time snapshots

When you are in the train, you will see the rails moving below you, and the ball will just move in your $y$-direction:

enter image description here

When you are outside, you will see the train moving. The ball will always be in front of the person who threw it. Therefore it will move on a diagonal line. That line is straight, however!

enter image description here