The conflict between Athens and Sparta only erupted after the Second Persian War; previously, although they were not exactly the best of friends, they managed to coexist more or less peaceably.
Both city states faced pressure from the growing Persian Empire which was expanding into Anatolia where both city states had colonies. The Greek colonies had revolted and were aided by Athenian warships. Although the revolts were put down, the Persian King, Darius sent troops to punish Athens. Sparta refused to participate in the First Persian War, but Athens managed to defeat the Persians at the famous Battle of Marathon. During the Second Persian War, the Persians were defeated by forces from both Sparta and Athens, including Spartan troops at the famous Battle of Thermopylae Pass.
The defeat of Persia removed any threat of Persian invasion; however it left a vacuum of political/military power in the Aegean basin. Both Athens and Sparta attempted to fill the empty space, often by force. Athens did so by means of the Delian League; Sparta with the Peloponnesian League. When both tried to force the same city-states to join their individual leagues, the Peloponnesian Wars broke out between the two. So the conflict between the two originated by the absence of Persian power in the area.