This was the first time that the 24-year-old Polish tennis star had reached the quarterfinals, while Federer was appearing in his 18th.
If the eight-time champion's exit was a surprise, the manner of it was even more so -- Hurkacz triumphed in three sets -- 6-3 7-6 (7-4) 6-0.
The 39-year-old Federer was seeking to become oldest man to reach Wimbledon semifinals in the Open era, but he looked a shadow of the player that has graced Centre Court over so many years.
The Swiss star made 31 unforced errors; Hurkacz made just 12.
Federer underwent two knee surgeries in 2020 and had been targeting a ninth Wimbledon title on his favorite grass court surface.
In June he had withdrawn from the French Open after his third-round win over Dominik Koepfer to protect his knee.
Federer's defeat on Wednesday was only his 14th in 119 matches at Wimbledon and his first straight sets loss at the grass court grand slam since 2002, the year before his first championship there.
"I noticed the mishits, awkward looking points from Roger and obviously the last set of course, 6-0," three-time Wimbledon champion Boris Becker told the BBC.