The eighth-seeded Williams, who lost in the first round at Melbourne Park in 2006 and was out last year with injuries before starting a comeback that included the Wimbledon title, was her own worst enemy.
She gave Yan two break points with a pair of double-faults in the first set, then virtually handed the Chinese doubles specialist an early break in the second with a string of unforced errors.
Williams, forced to run from side to side, finished with 29 unforced errors and only 19 winners.
Williams shrugged off her mistakes, saying: "Errors happen. That's tennis."
Fortunately for Williams, Yan didn't have enough offense and was content to slug it out from the baseline -- she finished with only five winners.
Williams, constantly fighting inconsistency, won five consecutive games after trailing 0-2 in the second set. Serving for the match at 5-3, she double-faulted twice while getting broken at love.
But Williams joined sister Serena, the defending champion, in the second round when she broke for the match as Yan netted a string of groundstrokes.
"I felt good out there," Williams said. "Had a lot of fun. Got to hit a lot of balls, which I felt was good. She definitely made me play some balls that I wasn't expecting to come back. It was definitely challenging."
The tournament experienced its first crowd violence problem as Greece's Konstantinos Economidis played last year's losing finalist, seventh-seeded Fernando Gonzalez of Chile.
Tournament officials said play in the match was interrupted for five minutes while police sprayed three people with pepper spray.
Five were evicted. Gonzalez won in straight sets.
Top-ranked Roger Federer, aiming for a third consecutive Australian title and claiming to be 100 percent recovered from a stomach virus that interrupted his preparation, was playing in the final night match against Diego Hartfield of Argentina.
Earlier, third-ranked Novak Djokovic showed he has recovered from the exhaustion that plagued him at the end of last year, when he played 87 matches, more than any other men's player. The 20-year-old Serbian star looked refreshed, sharp and hungry again as he beat Benjamin Becker 6-0, 6-2, 7-6 (5).
His brief off-season consisted of ... nothing.
"I tried not to do anything. That's a real rest," said Djokovic, seeded third after coming in at No. 16 last year. "I needed really to take it easy."
The results?
"Physically I'm ready, and mentally as well," he said. "I have a lot of motivation to do well this season, especially here in the Australian Open."
After the match, the television commentator implored Djokovic to do one of his impressions of another player -- specifically Maria Sharapova -- that have generated huge attention on Youtube.
At first, he resisted -- "I don't want to offend anybody," he said -- before giving in and doing a good impersonation, right down to the Russian player's tendency to brush strands of her long blonde hair back over her ears.
The crowd gave him a standing ovation, but it was clear that the reception in the locker room has been less positive.
"I didn't want to do any of the other tennis players," Djokovic said, explaining that Sharapova doesn't mind his take on her habits.
"I wasn't really trying to make fun of anybody or offend anybody. It's something that I think brings up some positive energy and something different."
No. 10 David Nalbandian, who beat Federer and Rafael Nadal at consecutive tournaments to win the Madrid and Paris titles, recovered from back spasms that forced him out of last week's Kooyong exhibition to oust Australian Robert Smeets.
Former U.S. Open and Wimbledon winner Lleyton Hewitt started his 12th bid to become the first homegrown winner of the national championship since 1976 by downing Steve Darcis of Belgium.
No. 12 James Blake beat Nicolas Massu 6-3, 6-2, 6-2 and Marcos Baghdatis, who lost the 2006 final to Federer, defeated 2002 champion Thomas Johansson.
Marat Safin, who lost the 2002 final but made amends with the title here in 2005, will meet Baghdatis in the next round after a 6-0, 6-4, 7-6 (2) win over Latvia's Ernests Gulbis.
Fifth-ranked David Ferrer ousted Edouard Roger-Vasselin of France, but No. 17 Ivan Ljubicic lost to Robin Haase of the Netherlands.
France's 35-year-old Fabrice Santoro broke Andre Agassi's record for most appearances at Grand Slam events in the Open era when he beat American John Isner in straight sets to kick off his 62nd major, including 38 in a row.
On the women's side, second-ranked Svetlana Kuznetsova of Russia beat Nathalie Dechy of France, while another Russian, No. 6-seeded Anna Chakvetadze, only played six points before Germany's Andrea Petkovic retired with a leg injury.
Also reaching the second round were No. 4 Ana Ivanovic, No. 9 Daniela Hantuchova and No. 14 Nadia Petrova. Tenth-seeded Marion Bartoli of France became the highest-ranked female to lose, the Wimbledon finalist falling to Sofia Arvidsson of Sweden.