According to the legend, King Shihram was a tyrant who oppressed his subjects. One of his subjects, a wise man named Sissa ibn Dahir, invented the game of chess for the king to play, to show him that a king needed all his subjects and should take good care of them. King Shihram was so pleased that he ordered that the game of chess should be preserved in the temples, and said that it was the best thing he knew of to train generals in the art of war, a glory to religion and the world, and the foundation of all justice.
Then King Shihram asked Sissa ben Dahir what reward he wanted. Sissa answered that he didn’t want any reward, but the king insisted. Finally Sissa said that he would take this reward: the king should put one grain of wheat on the first square of a chessboard, two grains of wheat on the second square, four grains on the third square, eight grains on the fourth square, and so on, doubling the number of grains of wheat with each square.
“What a dummy!” thought the king. “That’s a tiny reward; I would have given him much more.” He ordered his slaves to bring out the chessboard and they started putting on the wheat. Everything went well for a while, but the king was surprised to see that by the time they got halfway through the chessboard the 32nd square required more than four billion grains of wheat, or about 100,000 kilos of wheat. Now Sissa didn’t seem so stupid anymore. Even so, King Shihram was willing to pay up.
But as the slaves began on the second half of the chessboard, King Shihram gradually realized that he couldn’t pay that much wheat – in fact, to finish the chessboard you would need as much wheat as six times the weight of all the living things on Earth!
Source: http://www.historyforkids.org/learn/islam/literature/chesswheat.htm