Though Rene Descartes' grappling with the reality of his existence is the usual link to this type of thinking, there is a long history of the concept that reality is only an illusion, dating back to Plato and his man in the cave analogy.
It's current terminology is simulation hypothesis.