What is the difference between a king and an emperor? Why were there empires in Rome, Japan, and China, but kingdoms in Africa and Europe?
I understand that emperors are somehow higher ranked than kings, but why do we call some rulers kings and some rulers emperors?
Well, as kambanishtun said, there were empires in Europe. But we have to make a distinction between a Kaiserreich (an empire with an emperor as its head) and a Reich (a state which does not have an emperor). Therefore only the Holy Roman Empire, Byzantine Empire and eventually the Russian Empire were the only real empires (Kaiserreich) after the fall of the Roman Empire in the West.
The title of 'Emperor' was, contrary to popular belief, not a monarchic title in origin. When Octavianus was made emperor (Augustus), he was given a new function within the republican system of Rome. All other functions (consuls,...) continued to exist. True, the title held a lot of power, but it was still seen as a function within the republican system. Later on, under Diocletian, emperorship became fully monarchical.
The title emperor would be higher than that of king, because there were many local leaders (kings) that were allowed to keep some sort of autonomy in their native areas as long as they would be loyal to Rome. Alaric is an example. He was king of the Visigoths, but served under the (East) Roman Emperor.
When the Roman Empire fell in the West, the Roman Empire still continued in the East. Later historians would call the state the Byzantine Empire, eventhough the people who lived there considered themselves 'Romans'. There would be an emperor in Constantinople until 1453, when Constantinople fell to the Ottomans under Mehmed II.
The Roman Empire was (theoretically) restored in the West when Charlemagne was crowned Roman Emperor on Christmas Day, 800 AD. This title would later be known as "Holy Roman Emperor" and would lay the foundation for the Holy Roman Empire.
Now, why didn't other European rulers call themselves emperor? That's because in European tradition, an emperor can only exist in Roman tradition. And since Theodosian split the empire in a Western and Eastern half, each ruled by an emperor, there could only ever be two. As I said, Western emperorship was restored by the Charlemagne and the Holy Roman Empire. In the East, emperorship was directly continued by the East Roman Emperor in Constantinople until 1453. Later on, the Russian ruler would style himself "Czar" (from 'Caesar') and claim the same rank as the Holy Roman Emperor. He would claim to be the continued Roman Emperor in the East, since he had family tied to the last real East Roman Emperor, and since Russia and the Byzantine Empires were both Christian Orthodox states. Hence Moscow would be known as the Third Rome.
After Napoleon abolished the Holy Roman Empire (the Roman Emperor in the West) and proclaimed himself emperor, the whole Roman aura of emperorship was kind of forgotten and more states would claim to be Kaiserreichs. (I said 'kind of', since they would always claim some Roman link. Napoleon first had to destroy the Holy Roman Empire, so emperorship in the West would be vacant and his proclaiming of the French Empire was similar to Octavianus become emperor in Rome. The German Empire claimed to be the successor of the Holy Roman Empire.)
As for why the rulers of China and Japan were also called emperor, I unfortunaly do not know the exact answer. I can only say they did not fit within the European tradition of emperorship.
There were quite a lot of empires in Europe. The Holy Roman empire, British empire, French empire, German empire, Spanish empire, Austrian empire, Byzantine empire, Ottoman empire, Russian empire, Serbian empire, Bulgarian empire, Swedish empire, etc.
The difference is really in size and rank – emperors are in the European tradition regarded as of higher rank than kings, and their territories are usually much larger, often swallowing many kingdoms.
Emperors are Kings of Kings. The premise of your question is inaccurate. There have been Emperors in Europe outside of Rome ( french, British and German) and Kings in the other places you mention. To be an emperor you must have other kings to accept your overlordship and pledge fealty to you. For example Victoria was only made Empress of India after all the Indian Princes and Kings pledged their loyalty to her (and some brown nosing by Disraeli) and remained Queen over her other dominions who did not have local leaders of such standing. There was also a tradition of Emporers in Islamic Africa, but has receded since islamic fundamentalism has increased due to the Koran proclaiming only God being able to be a king of kings. An example of this is the King of Morocco changing his title from Sultan to his current title in 1957.
You could call the emperor of Japan a king if you want to really. The tendency is to translate 'tenno' as Emperor, but the only recognized "Emperor" in the tributary system(aka International Law a la China) of East Asia was the Chinese huangdi . Other states had to deal with lesser titles (at least in foreign affairs).
That being said, even the Korean/Manchurian Kingdom of Goguryeo (37 BCE – 668 CE) claimed parity with their 'daewang ,' as did the rulers of Balhae (698 BCE–926 CE) . Claiming the title or the equivalent of "emperor" was a challenge to China and really the Japanese were able to claim ontological 'superiority' only because of their peripheral relationship within the tributary system in East Asia.
Note when Chosun (1392-1910 CE) was 'freed' from the Chinese sphere of influence by the Japanese in the Sino-Japanese War (1894-1985), what followed afterwards was an elevation of the Chosun king to Emperor with the cessation of tributary relations.