According to Wikipedia, the legend doesn't say that Athena founded the city, only that she wanted to be a patroness of the existing city and give her name to it. She won that right by defeating Poseidon in a contest. https://en.wikipedia.org/wiki/History_of_Athens