The Doctor visited the diner because it was there, and he had nowhere else to go. The Doctor got there in some some unidentified vehicle, with nothing but his guitar. He doesn't know where his TARDIS is (which he admits to Clara) and has been looking for it.
We see at the end of the episode that he's dropped off by
Clara and Ashildr
in somewhere that looks very much like Nevada, with no memory of how he got there, and picked up by a unknown passer-by. It's very likely that he's come back to that same spot to try to figure out why he was there in the first place.
One he got back there, the only thing in sight was a diner. Note that, from his perspective, there are some things odd about this diner (assuming he's in the exact same place):
- It wasn't there before. He may believe he just didn't notice it, or that he's a bit lost, but seeing a diner that shouldn't be there would be odd.
- It's a bit of an anomaly, sitting in the middle of the Nevada desert. There's nothing else nearby, so how can it afford to stay open?
- It likely looked familiar, since it looks exactly like the diner from "The Impossible Astronaut" (though that one's in New Mexico).
Even beyond the oddities of the diner, it's the only place nearby he was likely to find anyone to give him a hand in locating his TARDIS. It's only reasonable that he would go inside and try to figure out what's going on around him.
We know the diner wasn't there by accident, since it's really
Clara's stolen TARDIS, made up to look exactly like the diner, probably there to return The Doctor's missing TARDIS to him.
But, from The Doctor's perspective, it was just a weird diner and he decided to go in.