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.
Toddler uninjured after being knocked over by Obama family dog
Florida bear attack: Black bear mauls woman's face