Well, suppose, for the sake of argument, the flight crew noticed a problem with the electrical system. Perhaps a small amount of smoke or a glitch in the power supply. So they program the autopilot to take them to the nearest emergency airfield, just in case they need to divert if things get worse, and investigate the problem.
In the middle of this investigation, they have a routine sign-off, because they have not yet determined the nature of the problem or if they have an emergency.
After the routine sign-off, things turn for the worse in a hurry. They execute the pre-programmed turn, but are soon overcome by smoke. Once the pilots are incapacitated, the aircraft continues on its last programmed course until all fuel is consumed and they crash into the middle of the Indian Ocean.
The problem with that is that there is not one iota of evidence that there was any kind of problem. Second in such an event their oxygen masks drop. Third they push one button the cabin pressure increases forcing all the smoke out. Fourth they push another button and the computer takes them right back to the airfield they just left.
So they program the autopilot to take them to the nearest emergency airfield
So then why didn't they go to those airfields?? They went right by two airfields when they turned around without as much as a wink. If that plane had been programmed for those airfields they would have been there -- smoke or no smoke.