Lochte logged a time of 4:07.06 at the USA Olympic swimming trials, bettering Phelps' mark of 4:07.89.
Because the top two finishers qualified, Phelps nevertheless became the first swimmer in United States history to qualify for four Olympics.
Phelps, the two-time defending Olympic champion in the 400-meter event, lost a U.S. trials final for the first time since Ian Crocker defeated him in the 100 butterfly in 2004.
Also qualifying for the Olympics Monday were Peter Vanderkaay in the 400 free and teenager Elizabeth Beisel, who triumphed in the 400 individual medley.
Exploding whale video goes viral on Internet
Wisconsin business offering 'therapeutic cuddling' forced to close