When was the first pope elected?
Maybe Linus, or Leo I, or Gregory I, or Alexander II. It depends on what one means by "elected."
The Pope, which simply means "father", was not referred to in such a manner for centuries after the founding of a Christian church in Rome. The bishop, or head of the local church, of Rome was of no more significance than the bishops of Jerusalem, Ephesus, or any other major city. The bishop of Jerusalem was considered the major bishop, if anyone. Bishops were elected by the members of the church, so in one sense they were all "elected." The type of election used today, ie election by the College of Cardinals, dates from the 11th century.
The first real Bishop of Rome was Linus, around AD 76, followed by Cletus and Clement. Clement was the first to write a letter to another major church (at Corinth) in his own name, but as a private person, not a ruler of the churches. By the end of the 4th century there were five great bishops, whose churches were considered the main centers of the overall Christian churches, Alexandria, Constantinople, Antioch, Jerusalem and Rome, but none were considered more important or powerful than any other. Calixtus I around 220 was the first to claim to be the head of the churches ("bishop of bishops") based on the descent from Peter, but was considered by other bishops a usurper. Siricus, Bishop of Rome from 385-398 was the first to claim universal jurisdiction over the churches, but this was disputed by nearly everyone. Innocent I (bishop 402-417) claimed to be "Ruler of the Church of God." Leo I, elected 440, is sometimes called the first "pope" because of his successes in delivering the city of Rome from Attila and Genseric the Vandal in 452 and 455. But it was Gregory I, who was head of the Roman church from 590 to 604, who is generally considered to be the first Pope.
Gregory rose during a time of great anarchy when, after the Goths and Visigoths, the Lombards were devastating much of central southern Europe. His personal influence over Gothic and Lombard kings and the Emperor of Byzantium gave him great reputation and influence over events. He worked tirelessly to spread Christianity into Europe at large, sending teachers as far afield as the British Isles. Gregory never claimed to be a universal pontiff or a secular ruler, nor did he claim precedence over the Eastern Church. He in fact considered it presumptuous of the Patriarch of Constantinople to call himself "Universal Bishop." Unfortunately, in the 8th century the Popes began to amass temporal power after "Pope" Zacharias was instrumental in making Peppin the Short King of the Franks, and the rise of Charlemagne.
So the identity of the first "pope" depends upon one's definition. Gregory I is the usual answer, but it was not until Stephen II in the mid-8th century that the Pope actually held lands around Rome as a secular ruler, following the conquest of the Lombards by Peppin. It was not, however, until 1059 that Nicholas II created a group of "cardinal bishops" to meet to elect popes. So in a very real sense the first "elected" pope under the sort of electoral process used today would have been Alexander II in 1061. Both Nicholas and Alexander are not considered popes by everyone, however, as there were schisms in the church repeatedly. For two different lists of popes see below.
Traditionally, the Roman Catholic Church believes that Jesus Christ himself selected his apostly Peter to be the first pope. So, in that sense, you could say that the first pope was selected around 33 AD. After that, however, the question is much harder to accurately answer. The reason is because it is hard to define "elected." Popes after Peter were all selected in one way or another, but I am not sure that you would say that they were all elected.
Popes have been selected in more or less the modern way since around 1100, but at many points in the years in between, secular rulers had a lot of influence over who became pope.
For a very detailed discussion of how popes have been selected, follow the link.