The FBI got involved first, because Kelly has a friend in the FBI, and she told him about this "cyberstalking" crap. Following that, "cyberstalking" is within the FBI's jurisdiction. Likely not solely within the FBI's jurisdiction, but still, it is something the FBI is allowed to pursue, under 47 USC 223, Obscene or harassing telephone calls in the District of Columbia or in interstate or foreign communications.
When the FBI got involved, it was not investigating Petraeus, at all.
Best explanation I have heard so far.