Selby dropped the opening three frames in Furth before bringing himself back into the match with a superb break of 137 and then quickly reducing the deficit to just one frame.
But 22-year-old Yuan was not to be denied victory over the world number three as he held off the fightback to book a place in the main draw.
Selby's premature exit followed seeded pair Luca Brecel and Anthony McGill crashing out after respective first-round upsets at the hands of Chinese pair Wu Yize and Si Jiahui.
World number nine Brecel secured his third ranking title with victory in the Championship League last month but was beaten 5-1 by 18-year-old Wu, who secured progression with a break of 109.
Scotsman McGill, a Crucible semi-finalist in 2020, opened with a knock of 117 before suffering a 5-2 loss to 20-year-old Si.
Iranian world number 17 Hossein Vafaei forfeited his first-round match after failing to appear, reportedly due to visa issues, resulting in a 5-0 walkover win for Xiao Guodong.
There was also an early exit for 2006 Crucible winner Graeme Dott, who lost the final three frames of his match with Yuelong Zhou to suffer a 5-4 defeat.
Former world champion Stuart Bingham, Gary Wilson and Ryan Day were among those to safely progress to round two, while world number two Judd Trump overcame Thailand's Noppon Saengkham 5-2 in the qualifying round.
Elsewhere, Ireland's Michael Judge claimed the scalp of defending champion Fan Zhengyi - who upset Ronnie O'Sullivan in the final of the previous edition of the tournament - with a 5-1 qualifying success.