Your question should be closed as a duplicate. The answer has nothing to do with light, per se. The answer is that the direction of any motion is frame dependent. To see this, consider the following...
Suppose you stand at the origin of your horizontal x axis and shine a light vertically up. What that means is that the light moves further and further along your vertical y axis, but does not move at all along your x axis- the x coordinate of the light is always zero. That is the definition of vertical motion.
Now suppose that at the instant you shine the light, I happen to be walking past you at a meter per second. Let us consider the motion of the light in my frame. After a second, the light will be about 300,000 km above me, but not directly above me, since in my frame the light has an x coordinate of -1 meter. After two seconds, the light will be about 600,000 km above me, and now it will have drifted further behind me, with an x coordinate in my frame of -2 meters. And so on. With every second that passes, the light has an x coordinate in my frame that puts it an extra meter away from my vertical axis. So in my frame, as a person walking past you, the light is following a slightly angled path, not truly vertical one.
What I have depicted above is true of any kind of linear motion, be it the motion of light or of a bouncing ball. It has nothing to do with momentum etc.