It was an uncharacteristically lacklustre performance by 2022 winner Swiatek, who made 41 unforced errors as she struggled to control her forehand in particular.
By contrast, Pegula was locked in from the start and broke in the opening game, courtesy of a Swiatek double fault.
Another gave Pegula her second break to go 3-0 up in a flash and she proceeded to take the first set in just 37 minutes.
The 30-year-old New Yorker continued to delight her home crowd, with her crisp, accurate groundstrokes keeping the pressure on Swiatek.
There was an improvement from Swiatek in the second set and, having been broken again, the Pole hit back immediately.
But Pegula kept up the pressure and secured the decisive break at 3-3 before she pressed on towards victory.
Nerves finally emerged as Pegula served for the match but she converted her third match point to secure a place in the semi-finals.