The Roman general Pompey, when he first conquered West Asia around 50 BC, was embarrassed to find that people there were worshipping him as a god, coming out of the cities to pray to him, bowing down to him, making statues of him and putting them in temples and even sometimes sacrificing to these statues.
If he asked about it, Pompey might have found out
that people were worshipping him as a god because they had been used
to doing that with their own rulers since the time of Alexander
the Great, nearly 300 years earlier.
After Pompey was killed, and Augustus came to power, Augustus found it useful to allow this emperor-worship to continue (and I don't know that he could have stopped it anyway). So people in West Asia and Egypt continued to worship the Roman emperors as gods right up until everybody converted to Christianity in the 300s AD. In fact, emperor worship was one of the last parts of the pagan tradition to stop, well into the 400s AD.
You might say that it was ridiculous to worship a person as a god, but it wasn't as ridiculous as it seems to you. The Romans worshipped a lot of gods, some more powerful than others, but none of them as powerful as the God that Christians, Jews, or Moslems think of today. And there were many less powerful gods too. Why shouldn't the emperor be one of them? The emperor was just as remote to most people as the gods, you never saw him, you never spoke to him (or he never spoke to you anyway). And he was just as powerful: he could send food when there was a famine, he could make there be a canal where you needed one, he could have a whole city full of people killed if he liked. In fact, he probably did all of these things more often than the gods did. So why not pray to him?
Learn by doing: do we treat our leaders as if they were gods? Why or why not?
Early Christianity and the emperors