Yeah, but not true at all. Sure, there's plenty of garage mythos (though that's decidedly old-school now). But living at your office...? It happens occasionally and it's nuts, but it's not at all part of SV culture. This is first I've heard of Elon/et al doing it.
I dunno, I slept in my office in grad school. It wasn't out of needing to feel like a hard worker or showing off or whatever, it was more that sometimes I just felt like working until I was about to fall asleep, and then I was too tired to head home.
I would love to sleep at work but I am not allowed to (I work at a courthouse). Monday through Friday I work downtown, my gym is downtown, all my going out is downtown, I am and plan to be kid-free forever... if I could save the commuting time, which is minimal, and get an extra hour of sleep or stay out a little longer and socialize, I would be delighted. Heck, I would even do a little extra work if I could just recline on the couch and fall asleep.
Much of my work in grad school was episodic, so I often slept on my lab's couch. I'd work for an hour or two, nap for a while until it was time for the next step, and so on.