Socrates took his life while in jail for a crime that he did not commit because he felt it was the right thing to do. Socrates valued morals and frowned on hypocrisy, and since he felt that breaking a law was immoral, he would not escape his punishment even though he has being jailed for a crime that he didn't commit, he refused to commit a crime even if it involved saving his own life.
In his time many people professed that Socrates was the smartest man alive, which made him angry because he himself believed that he knew nothing. That very fact made him known as the smartest man alive as stated by the oracle at Delphi was that because Socrates knew that he knew nothing, and other people knew nothing and thought they knew everything; this made Socrates the smartest person alive because in fact he was correct about not knowing anything. Socrates was very dissatisfied with this so he spent most of his days in the "Agora," the Greek marketplace, inquiring men to point out how much they knew. .
Socrates would ask a question to a person, and he would appear to get excited when the person thought they knew the answer, but when the person would state the answer Socrates would point out the flaws in the person's arguments and make the person appear to be ignorant so therefore they would try to find the real answer out, but Socrates believed that he was unable himself to reveal the answer to his "disciple" because he felt that everyman should find out himself. Now Socrates goal was to provoke thoughts throughout Athens, and he seemed to accomplish it with every man he stopped and made feel ignorant. The problem with this was that he managed to irritate some of Athens" most powerful men, and they did not find it liberating to be made a fool of in front of many people in the marketplace. So these men decided to indict Socrates of corrupting the minds of the youth, for mocking the gods, and for teaching falsehoods.