Imperātor originally meant "commander" in Latin—a high-ranking military officer, what we would call a commander-in-chief or a general. It comes from imperō, meaning "I command", the same root as the English word "imperative", as in "imperative mood", the grammatical form of a verb used as a command, and "categorical imperative", a moral precept without conditions, a sort of moral command. And originally imperium meant the region under a commander's or magistrate's authority, not an empire.
Here's my understanding of how imperator came to mean emperor. (Nota bene: I'm not an expert on Roman history, and I had to hit Wikipedia several times to check what follows, so take this cum grano salis.)
During the Roman Republic, the Romans were proud that they had a republic—something like the way Americans today are proud to have a republic rather than a kingdom. A position of leadership, such as Consul, had to be earned, on the basis of merit, and chosen (somewhat) democratically by the Senate, and only for a one-year term. When that came to an end with Julius Caesar's accession to perpetual dictatorship, the Romans didn't rename the nation. They continued saying that they had a republic. They kept making flags that said SPQR. Caesar styled himself imperator to retain the fiction that he was just a military commander, not a monarch. It was a bit like Qadafi calling himself a mere "Colonel" in Libya even as he held ultimate political power. Imperator, as you said, was a title bestowed on military leaders in honor of an important victory, and was often an important credential for someone running for Consul. So, calling the monarch imperator helped the Romans pretend that they still had a republic. De jure it still was a republic, de jure the (rubber-stamp) Senate still held ultimate authority, but de facto it was a monarchy.
In the years after Octavian got the, er, empire on a solid footing, imperator came to be used less and less to mean military commander and more and more to mean the person who held the position of de facto monarch of Rome. When Charlemagne started the Holy Roman Empire in 800 A.D., he styled himself imperator to establish continuity with the Roman emperors. This time it was de jure, even invested with Papal authority. That anchored the word's meaning in "top monarch" to the present day, whence English "imperial", "empire", and "emperor".