The actor played doctor and FBI agent Dana Scully in the Nineties series, alongside David Duchovny as paranormal investigator Fox Mulder.
Speaking on the NPR podcast Fresh Air, Anderson said she nearly lost out on the role.
Terry Gross asked how she got the job when she was 24, which is younger than most doctors.
The actor replied: “Well, I lied. I lied about my age in the first audition, I said I was 27.”
Anderson explained that series creator Chris Carter was “convinced” she was right for the part, but the network thought otherwise.
“All these other actresses from the theatre community in New York were being flown in because I wasn’t good enough for The X-Files,” she said. “So I was auditioning suddenly with Jill Hennessy and Cynthia Nixon.
“Anyway, eventually I ended up getting the job.”
X-Files creator Carter recently apologised for the way the series ended, and seemed to assign blame to Anderson for the fact it would never return.
Anderson can currently be seen playing Margaret Thatcher in season four of The Crown on Netflix.
Many viewers have been conflicted over her portrayal in the series, which sees Anderson bring humanity to the controversial leader.