There were several factors that forced Farrier to fly straight and land in the direction he was heading
His position and heading precluded a different landing approach
Farrier was over the mole when he turned back to kill the Stuka. But he was out of power and bleeding air speed and altitude. He had no choice but to land while heading east because his plane wouldn't have stayed aloft long enough to fly east and then come back west. To do that, he would have had to fly as far east as he did to land in the movie and then back west just as far--the plane simply did not have the speed and altitude to pull that off. On top of the distance, he would have had to turn, and turning an airplane 180 degrees bleeds off a tremendous amount of air speed unless you have power. If he dropped below the Spitfire's stall speed, he would just fall right out of the sky. He had already turned the plane 180 degrees with no power to get the Stuka, which itself kind of stretched realism.
Getting his gear down was a priority and a distraction
In addition to having no power, Farrier had to lower his landing gear manually. This required physical effort and a dangerous division of his attention. Keeping straight and level while he did this was his best bet to get the gear down and land.
Ditching in the water was a bad option
Ditching a plane in the water carries significant risk of getting hurt or killed if the plane hits the water wrong, and without any power to make adjustments, that risk is magnified. Worse, ditching puts the pilot in a hostile environment once he has landed where drowning or hypothermia is as likely as rescue.
Parachuting likely required more altitude than he had
Jumping from the plane would require enough altitude for the pilot to engage the chute and for the chute to open. Paratroopers in WWII could jump from as low as 300 feet, but that was with an easy jump out a door and the static line deploying their chute immediately. A pilot bailing out had to make a tricky jump from a cockpit and pull his own rip cord. He was already probably below 1,000 feet when he shot the Stuka and would have been losing altitude fast. By the time he unbuckled his harness, got the canopy open, and made his jump, he could have been too low to risk it.
Farrier was unlikely to know where the German held territory was exactly
Farrier was landing on the beach, going out beyond the masses of British soldiers, so as not to hurt them. He had just arrived on the scene and likely did not know that a kilometer or two down the beach was German controlled. When he landed, he would torch the plane no matter what, because either way it would have to be abandoned. He probably realized when he torched the plane that he was in enemy territory and too far from the mole. He didn't bother running since he'd likely just get shot.
Landing is dangerous
Despite the heroics you sometimes see in movies--including Collins ditching his plane in the water earlier in Dunkirk--landing a high performance aircraft under bad conditions is extremely dangerous. Gear-up landings can be pulled off (dangerously) on a runway, but would be disastrous on sand. Landing without power is also very dangerous since you basically have one shot at a good approach. Straight and level to the east was his best bet to get gear down and make a safe landing.