Mikhail Grobachev resigned as president of the Soviet Union in December 1991 because the USSR was dissolved in December 1991. He had to resign as president because there was no country to be a president of anymore - the country changed completely and disintegrated into several smaller countries that each had its own president after a while.