The Doctor stole his TARDIS on Gallifrey. He's confirmed this multiple times, such as in "The Big Bang" (although he often says it was "borrowed" rather than "stolen" because he always planned to give it back one day).
In "the Doctor's Wife", the TARDIS (as Idris) says she "stole" the Doctor because he "was the only one mad enough" (and, unlike him, she has no truck with the "borrowed" euphemism — she openly says she'd no intention of ever giving him back).
We also know that he deliberately chose a Type 40 that was ready to be decommissioned rather than a newer model, for some reason beyond it being easier. He never directly tells us why on TV, but in the novel Lungbarrow he says the later models were 'soulless', and Idris's lines in "the Doctor's Wife" imply that she's the one who made him think that.
The novel The Gallifrey Chronicles tells us that even the bit about it being scheduled to be destroyed may be a bit of a lie—Marnal had been asked by the Time Lords to return his TARDIS to get a new one, but the Doctor stole it before he could.
The First Doctor implied a few times that he'd built his TARDIS, which is probably yet another lie.
The episode "The Name of the Doctor" revealed additional information: the Doctor originally intended to steal another TARDIS, only to have an incarnation of Clara Oswald recommend the Type 40 he's stayed with for 700 years (this does not contradict "the Doctor's Wife" as the TARDIS would still have to have let him in and might have influenced Clara).