Olympic champion Milak beat the record he set at the 2019 worlds in Gwangju by 0.39 seconds and finished 3.03 seconds ahead of silver medallist Leon Marchand of France.
The 22-year-old Milak delighted the home crowd by providing them with Hungary’s first gold at these championships.
“It was a fantastic feeling. As soon as I stepped in the starting area, I didn’t hear or see anything. It was like being in a dream. I waited three years to swim a personal best and it came off,” he said.
Bobby Finke of the US won the men’s 800m freestyle with an electric late burst to finish ahead of Germany’s Florian Wellbrock and Ukrainian Mykhailo Romanchuk.
The win for Finke was a boost for the US team after 100m free Olympic and world champion Caeleb Dressel pulled out of the semi-finals in that event for medical reasons.
Finke, who sat in fourth place for much of the race and was still behind three swimmers at the final turn, posted a personal best time of 7:39.36.
As he did in Tokyo, Finke timed his race to perfection, delivering a blistering final 50m in 25.93 seconds to move ahead of his European rivals.
“I knew I had to just stick with them and stay with what I am good at, the finish. I knew the 50 length was going to hurt but it was worth it,” said Finke.
Nic Fink delivered a second victory for the US, winning the 50m breaststroke in 26.45, three hundredths of a second ahead of Italy’s Nicolo Martinenghi with another American Michael Andrew taking bronze.
The loss of Dressel means he will miss an anticipated 100m free showdown with Romanian teenage talent David Popovici, who won the 200m free on Monday.
Dressel missed the 4x100m mixed medley race but his team won gold with ease, leading from the front with Hunter Armstrong leading off in backstroke before Fink extended the lead in breaststroke.
Torri Huske in the butterfly and Claire Curzan in freestyle held on to the lead with some comfort, finishing 02.55 seconds ahead of the Australians with Netherlands taking bronze, narrowly beating out Britain, the defending Olympic champions.
China’s Yang Junxuan won the women’s 200m freestyle in a time of 1:54.92, beating Australia’s highly rated 18-year-old Mollie O’Callaghan, who took silver 0.30 behind.
The Chinese had two medals to celebrate with Muhan Tang taking bronze ahead of Britain’s Freya Anderson.