Why? Because he had no choice. If he’d resigned for family reasons, the FBI investigation would have surfaced, magically, and Petraeus would have been left with no honor at all. By confronting the blackmail (notice that I use the word rather freely), he short-circuited the damage Obama could do. Which also means that Petraeus has no reason to lie when questioned (as he will be) by Congress about Benghazi.
This is only a plausible explanation if he is signaling to Republicans that he would be willing to testify. There is no reason to believe the FBI investigation would surface if he told the 0bama administration he was willing to continue to play ball.