Thiem led by two sets to love but suffered a first opening-round loss on the Parisian clay.
Thiem has struggled for form since winning his first grand slam title at the US Open last summer but looked to be finding a way past Andujar when he opened up a two-set lead.
However Andujar, who beat Roger Federer in Genève last week, fought back to win 4-6 5-7 6-3 6-4 6-4 and record his first victory over a top-five player at the age of 35.
Thiem took a six-week break in March and April to step back from the demands of the tour and bubble life and must now reflect on a first opening-round loss at Roland Garros.
The 27-year-old, who was seeded fourth, has reached at least the quarter-finals on his previous five visits, losing to Rafael Nadal in the final in 2018 en 2019.