The I-Boat was lurking in an area that was basically a known crossroads of the sea lanes in that particular area. The Commander testified at McVeighs courtsmartial that it would have made no difference whether the Indy zig zagged or not, he just happened to be in perfect position for the attack, partly through skill, but a lot by luck and chance. He was actually quite surprised that the Navy would actually try the guy.
It was done to make a scapegoat for the disaster, which was actually the fault of senior officers, their procedures and policies in that theater. To make a long story short - nobody realized the ship was missing. So, those few that did survive spent 8 days in the water, most succumbing to the elements, and with sharks taking 4-6 men per hour after the second day. Blind luck that they were found at all.
I can imagine the bad dreams that came out of that one.