The Roman general Pompey conquered West Asia around 50 BC. He was embarrassed to find that people there were worshipping him as a god. They would come out of the cities to pray to him, and bow down to him. They made statues of him and put them in temples and even sometimes sacrificed animals or incense to these statues.
If he asked about it, Pompey might have found out why people were worshipping him as a god. It’s because they had been used to worshipping their 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 kept on worshipping the Roman emperors as gods. They still did it 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 their gods were as powerful as the God that Christians, Jews, or Moslems think of today. And the Romans believed in 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. The Roman emperor 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?