Andreescu, who is 19, bested Williams 6-3, 7-5.
"I've worked really, really hard for this moment ... This year has been a dream come true," Andreescu said after the match, calling Williams a "true legend of this sport."
But she joked that while Williams was a formidable opponent, her biggest obstacle to victory was the crowd, which was firmly in Williams' camp.
"I know you guys wanted Serena to win, so I'm so sorry," she said with a laugh.
"I’ve dreamt of this moment for a really long time but I never thought it would come this soon,” Andreescu told ABC News after her victory. “It’s definitely been one of my dreams to play her and so it was just a really good opportunity for me. I just went out there, I played my game. The goal was to make her work for every shot and I think that’s what I did really well. I try not to feel intimidated at all. And I just try not to focus on who’s on the other side.”
Andreescu admitted that the crowd was something that she had to deal with throughout the entire match.
"I mean it’s really tough when they’re really really loud but it was expected so I just went out there and try not to focus on it and I think I did a really good job at just staying very calm,” she said.
Williams, who was vying for a record-tying 24th Grand Slam title and her first since giving birth to daughter Olympia two years ago, applauded Andreescu for playing an "unbelievable match."
"I'm just so proud that I'm still out here and competing at this level because it's not easy to be in this particular sport for 20 years," Williams said.
She thanked her team for helping her through the ups and, lately, the "downs and downs and downs and downs and downs." But Williams added, "Hopefully, we'll have some ups soon!"
And she expressed gratitude to the fans.
"Honestly, the fans started cheering so hard... I was really grateful for that," Williams said.
Among those in the stands was Williams' close friend Meghan, the Duchess of Sussex, who took a last-minute flight from London. Meghan was seated between Patrick Mouratoglou, Serena’s coach, and Serena’s mother Oracene Price, at Arthur Ashe Stadium in Flushing Meadows, New York.
Meghan and Williams have been friends since meeting at the 2010 Super Bowl in Miami.
Williams was ranked No. 1 in the world when she went on maternity leave but has not won a Grand Slam since giving birth to her daughter in 2017.
After Williams spoke out about the unfairness of women players being penalized because of maternity leave, the Women's Tennis Association (WTA) changed its rules to add more protections for moms on the tour.
Williams lost last year's U.S. Open in a tense and controversial match against Naomi Osaka. More recently, she made it to this year's Wimbledon final in July but lost in straight sets to seventh-seed Simona Halep.
The night, however, belonged to Andreescu and she relished the moment.
"Having Canada’s support ... means so much to me. So all I can say is that I’m very grateful for it but I’m not done yet so let’s keep it going," she told ABC News.
When asked about how she was going to celebrate her victory, she told ABC News, “I haven’t really thought about that. I’ll probably have a really good dinner with my team and then we’ll go from there.”
ABC News' Joshua Hoyos, Katie Kindelan and Matt Claiborne contributed to this report.