A Nigerian man pleaded guilty Wednesday to trying to blow up an international flight for al-Qaida with a bomb in his underwear, taking a federal court in Detroit by surprise on the second day of his trial.