Film
In the film several of Red squadron seem to have panicked and broken formation. Both Red One and Red Five peeled off, earning an admonition from Red Leader.
Red Leader: Stick close to me. Red One, where are you going?
Red One: They're all over me. I'm trying to lose them.
Red Five: This is Red Five. I need help! [he dies]
It's not really clear, but it's certainly possible that Red Five died because of the loss of cover from his squadron mates.
Novelisation
The implication seems to be (at least according to the official novelisation) that Red Five, and indeed the remainder of Red Squadron were intentionally making themselves targets in order to distract the gate's gunners from concentrating their fire on the Y-Wing bombers.
A wing of Red Squadron fighters strafed the orbital gate station, maneuvering among clusters of sensor towers and laser turrets. The attack did little damage, but inflicting damage hadn’t been the goal—the fighters had claimed the station gunners’ attention, left a few turbolaser platforms in burning ruin, and given Gold Squadron’s Y-wings the opportunity for a bombing run.
That's why Red Five's course was so erratic and dangerous and ultimately what killed him.