PERTH, Australia — Gen. John Allen, the top American and NATO commander in Afghanistan, is under investigation for what a senior defense official said early Tuesday was “inappropriate communication” with Jill Kelley, who was seen as a rival for David H. Petraeus’s attentions by Paula Broadwell, the woman who had an extramarital affair with Mr. Petraeus.