Socrates was alive during a period of transition for Athens. It had just suffered a major defeat at the hands of its major rival Sparta. Many Athenians questioned whether Athens should seek a new direction in the future. The leaders of political, religious, and academic institutions were fighting to keep the status quo against this tide of progressivism in Athens.
The very nature of Socrates required him to question authority. Socrates was a staunch critic of Athenian democracy and the political leaders of the city. He also railed against the superstitious nature of the Oracle and other religious institutions in the city. He was really making political and religious leaders look inadequate at a time when said leaders needed to attain the support of its subjects.
The actions of Socrates at his trial did not help his cause. He was very arrogant and had an elitist attitude. When he was found guilty, Socrates suggested that the city pay him for his troubles rather than put him to death. That did not sit well with the jury. Socrates had the opportunity to be exiled, but felt that death was the better option for himself.
Socrates was put on trial in 399 B.C. for allegedly committing impious acts--not revering the Athenian gods and introducing new deities--and corrupting the city's youth. Some historians believe Socrates was also critical of Athenian democracy, which could have encouraged his political opponents to place him on trial.
According to Athenian practice, he stood trial before a jury of Athenian citizens chosen by lot. The jury convicted Socrates on these charges, so they held another vote to determine his punishment. Because impiety and corruption of the youth were considered heinous crimes, the jury voted to give Socrates the death sentence. After Socrates received the death sentence, his followers (two of whom included Plato and Xenophon) tried to get him to flee Athens; however, he refused to leave. He was forced to commit suicide by consuming a drink made of hemlock, a poisonous plant.