"Dictator" was actually an elected position in the Roman Republic. It was an emergency measure to be used by the senate in times of a national crisis when the shared two consuls administration (elected for one year) system could not produce strong decisive leadership. This allowed them to elect one powerful general to make the tough decisions and lead them against an approaching enemy. Sadly there were no limits on the power of the dictator, and he could even "proscribe": that is, post a list of names of Romans he wanted dead. Any citizen who killed these people could have their property. Most proscribed people got out of Rome fast, and maybe came back when the dictator was gone and things had cooled down.
Julius Caesar was never elected dictator. Hie enemies, the right wing Bonii (good men), put it about that he intended to declare himself one, but that was really impossible for him because he was a jurist, a legislator, and a very law abiding man. The propaganda against him is still working.