Wei Yan was from Yiyang Commandery (), which covered parts of present-day Nanyang in southern Henan and parts of northern Hubei. He started his career as a foot soldier under the warlord Liu Bei, probably sometime between 209 and 211 when Liu Bei was in southern Jing Province (covering present-day Hubei and Hunan). Around 212, he followed Liu Bei into Yi Province (covering present-day Sichuan and Chongqing) and fought on Liu Bei's side in a war against Liu Zhang, the Governor of Yi Province (益州牧). He made several contributions in battle and was promoted to the rank of a General of the Standard () probably in 214 after Liu Bei seized control of Yi Province from Liu Zhang.