Khalid Sheikh Mohammed, accused as the mastermind of al-Qaida’s Sept. 11, 2001, attacks on the United States, has agreed to plead guilty, the Defense Department said Wednesday.