The war between the Greeks and the Persians came about for at least two reasons. One reason, at least from the point of view of some Greeks, was ideological. From what we can get from such sources as Aeschylus’s play The Persians, the Greeks saw themselves as free people and the Persians as slaves to their rulers. The Greeks felt that the Persian system was one of monarchy and oppression while their own system allowed for more freedom. In one way, this difference helped lead to war.
A second, less ideological, explanation holds that the war was simply a war caused by empire. The Greeks were expanding throughout the Mediterranean. This inevitably brought them into conflict with the Persian Empire, which was expanding west into Asia Minor. The Persians conquered cities that had been set up by Greek colonists in Asia Minor. The Athenians helped some of those cities rebel in 499 BC.
When the Athenians did this, the Persians put down the rebellion and then invaded Greece. This was done partly for revenge and partly to expand their empire. The Battle of Marathon was the first and last major battle of this first invasion. The Greeks defeated the Persians at Marathon, causing the Persians to pull back and wait ten years before invading the Greek mainland again.