You don't have to get on a ferry boat to the Greek islands to enjoy swimming in the Aegean Sea. Athens has a string of beaches which begins in Pireaus, known as The Apollo Coast and like any city the further you get out of town the better the beaches are.
While there are people who do swim in Pireaus and Faliron, I don't, (though it probably won't kill you, at least not right away). This does not mean that I wouldn't if it was a really hot day and I did not have the energy to get further out. I have been swimming in worse places than the city beaches of Athens and I have lived to tell about it though I was too young to know any better. But in general if you want to play it safe and enjoy the best beaches Athens has to offer, you should begin with the Kavouri-Vouliagmeni area and find the beach most suited to you between there and Sounion.
If you want to stay in a hotel convenient to Athens but still on the beach then probably a resort hotel like the Divani Apollo Palace or the Astir Palace Hotel are just an hour from the city. There are others in the area of varying prices and quality. For those who want to go all out, another 15 minutes by car is the Grand Resort Lagonissi with the Sunset Suites costing about 2774 euros a night, though a normal Deluxe room with a view of the bay a mere 312 euros a night. But if you stay here you have already saved the cost of the ferry to an island. There are a number of less expensive hotels in Glyfada and Voula which will allow you to get into downtown Athens by taxi, bus or tram, and also be close enough to the clean beaches, say 10 minutes by bus or taxi. See Athens Coast Hotels for many more choices.
Between the public beach of Vouliagmeni and the next town which is Varkiza are The Coves where you park your car at the top and walk down to some small pebble beaches and flat rocks, which are like finding somewhere remote on an island, (except for the hundreds of young people who come on weekends and in the summer because it is free, pretty clean, great for snorkling and because some people just don't like sand).
Depending on the wind and other variables some beaches are popular with windsurfers, mostly between Saronida and Anavissos. Anavissos has a long open beach and lots of fish tavernas and is a favorite place for Athenians during the weekends and especially on Sunday. There are a few small scattered beaches between Anavissos and Sounion. In Sounion there is a small beach below the temple with two tavernas and the Aegeon Beach Hotel, another alternative to going to the islands. What more could you want? A beach, ancient temple and 2 tavernas.
Between Sounion and Lavrion are a number of tiny coves and beaches but the problem is finding them. The adventurous can continue on to Avlaki, Porto Rafti, Loutsa and Rafina, all pretty well built up now, all the way to the beaches of Nea Makri and Schinias(the best beach in my opinion-see daytrips.)
Public beaches like Vouliagmeni, run by EOT, (Greece's National Tourist Organization) charge admission and offer changing cabins, self-service restaurants, tennis courts, basket-ball and volleyball pitches, children’s playgrounds, canoes and pedal canoes for hire. Other public beaches run by EOT are in Paleo Faliro, Alimos, Glyfada, Voula, Varkiza, Alcyoni, and Lagonissi.
The best way to go to the beaches of Atika are by car, either a rental or get together with some friends and book a taxi for the day. As for public transportation the Coastal Tram goes as far as Voula. The blue public buses E2 and E22 go to Vouliagmeni and Varkiza and all the way to Saronida leaving from the University-Akadamias and going down Amalias Ave across from the National Gardens. But if you want a seat get it at the University. The yellow Attika buses leave from Areos Park, (near Platia Egyptos where Alexandras Ave meets 28-October Patission Street) and will take you to Agia Marina, Anavissos, Lagonissi, Sounion and Lavrion as well as to the beaches on the other side of Attika like Rafina, Porto Rafti, Marathon, Schinias and Oropos. (Article from Athens survival guide by Matt Barrett).