Wikipedia has a wealth of info on this topic: http://en.wikipedia.org/wiki/Origins_of_chess
Western chess (i.e. the chess we come here to play) wasn't 100% invented as-is. It was an adaptation of shatranj, which was an adaptation of the Indian game chaturanga, the mother of all chess (which is what rettdaniel basically said).
Culture (i.e. anthropology) is where all games spawn from (that's a very vague statement, I know). In chess it defines how the board and pieces look and how/why the rules and games themselves were created in the first place. Chaturanga is based upon armies battling each other. What have most cultures been doing for thousands of years? There's the why - and that's all you need for something to be invented. We are quite fortunate that some 1500+ years ago there were bored people looking to create a game that challenged them, which evolved into a game that is just as challenging to us. Don't ever say that nothing good came of war. ;-)
I read from collier's encylopedia that chess originated in India about 500 A.D. when a form of it known as chaturanga emerged. The Persians adapted the game and much of its nomenclature ("chekmate" derives from the Persian sha mat, "the king is dead"); and the Arabs, during the period of Muslim conquest, adapted the game with little or no change and spread it rapidly along the North African littoral and then into Europe.