Liu An was a grandson of Liu Bang 劉邦 (Emperor Gaozu 漢高祖, r. 206-195 BCE), the founder of the dynasty, and son of Liu Chang 劉長, Prince Li of Huainan 淮南厲王. He was famous for his love of books and music and was the author of numerous rhapsodies himself.
In 172 he was given the title of Marquis of Fuling 阜陵侯 and succeeded his father as prince of Huainan in 180. When the Seven Princes rebelled against Emperor Jing's 漢景帝 (r. 157-141 BCE) politics of curtailing their power, he considered participating, but in the end was loyal to the court. Emperor Wu 漢武帝 (r. 141-87 BCE) appreciated him for his sense of literature and ordered him compiling a commentary to the famous rhapsody Lisao 離騷 "Parting in sorrow".
Liu An had several thousand retainers, among the writers, philosophers and magicians, and ordered them compiling books presenting an overview of their knowledge and interpretation of the universe. The result of their "inner chapters" (neipian 內篇), "outer chapters" (waipian 外篇) and "middle chapters" (zhongpian 中篇) is the book Huainan honglie 淮南鴻烈, better known as Huainanzi.
In 122 Liu An decided to rebel against the emperor's further politics to diminish the position of the princes, yet his plot was reveiled, and Liu An committed suicide.