The official cause was lung cancer, but you can pencil “hard living” into the margin. He had long bouts with tuberculosis and alcoholism and crazy days of poverty in New York and two World Wars and got tossed in jail at age 56 as a Communist sympathizer. All that and Sam Spade too!
Raymond Chandler said it best about Hammett in his terrific essay The Simple Art of Murder:
He was spare, frugal, hardboiled, but he did over and over again what only the best writers can ever do at all. He wrote scenes that seemed never to have been written before.
That whole essay rocks, incidentally. You’ve got to go about two-thirds of the way down before Chandler starts grooving on Hammett.
Here’s a fine recap of Dashiell Hammett’s life from the SF Chronicle.
For all the (deserved) praise for The Maltese Falcon, I still think The Thin Man is a more delightful read.