I'm taking a greek and roman class in university and I have started to wonder when the city-states started to develop the sense of nation we have today.
Like in popular movies such as Troy and 300. In 300 they talk about fighting in order to protect all of Greece, but they were still a city-state. And in Troy they talk about going to troy as the nation of Greece. I understand that its not really the case in the time period that the movie are showing. But when would it have started to have them refer to each as greeks?
This is a bit hard to say - it depends a lot on what exactly you mean by "nation".
The classical Greeks certainly had a bond and considered all Greeks - Dorians, Aeolians, Achaeans and Ionians - part of the same people, the Hellenes.
This did not prevent them from being different political entities that frequently fought each other though. Still, they tended to unite in the face of external threats, such as the Persians - and the viewed other peoples the same way. Many Greeks believed that the Carthaganian war against Syracusae at roughly the same time as the events at Thermopylae (the First Sicilian War) was part of a Persian grand plan, as Carthage had been founded as a Phoenician colony and the Phoenicians were Persian subjects and the most numerous group providing ships and sailors for the Persian King of Kings.
Later, when Rome had conquered or subjected the Greek city states and leagues, the Greeks still viewed themselves as Greeks but had no idea of a Greek nation as such.
During the later part of the Roman Empire, the Greeks viewed themselves as Roman, as they were christian and Roman citizens, and the idea that they were Roman (Rhomanoi) was kept for a very long time - through the Byzantine Empire and even during the Ottoman Empire the Greeks usually referred to themselves as Roman.
The idea of a separate Greek nation in the modern sense, as opposed to a Roman one took real root in the late 1700s and early 1800s and culiminated in the Greek war for indepence and the formation of modern Greece in the aftermath of the Greek war of independence in 1832.