The Jews are being held captive, and the King is upset that his people can't register or capture them all. In his rage, he decides to kill all that he has captured.
He commands his elephant wrangler (that was apparently a thing) to get the elephants drunk and ready to rampage. The Jews saw the people gathering for the execution and fell down into Prayer. God is always ready to listen. So, He takes action and puts the King into a deep sleep and he sleeps through the appointed time.
But the Lord sent upon the king a portion of sleep, that beneficence that from the beginning, night and day, is bestowed by him who grants it to whomsoever he wishes. And by the action of the Lord he was overcome by so pleasant and deep a sleep that he quite failed in his lawless purpose and was completely frustrated in his inflexible plan. - 3 Maccabees 5:11-12
When the elephant handler woke the King at 10, the King was loopy and decided to have a party. He got drunk, and ordered the elephant handler to be ready the next day. He sent all his people home, telling them to return the next day.
As they prepared to kill the Jews, and the crowd gathered, the Jews prayed again. This time, God confused the mind of the King. He lashed out at his friends who were demanding the death of the Jews.
This was the act of God who rules over all things, for he had implanted in the king’s mind a forgetfulness of the things he had previously devised.Then Hermon and all the king’s Friends pointed out that the animals and the armed forces were ready, ‘O king, according to your eager purpose.’ But at these words he was filled with an overpowering wrath, because by the providence of God his whole mind had been deranged concerning these matters; and with a threatening look he said, ‘If your parents or children were present, I would have prepared them to be a rich feast for the savage animals instead of the Jews, who give me no ground for complaint and have exhibited to an extraordinary degree a full and firm loyalty to my ancestors. - 3 Maccabees 5:28-31
Now, his friends were mad. They thought the King was toying with them. They complained and demanded that he kill the Jews, saying that so many had gathered that Alexandria might see riots and be plundered, so the King agreed to kill them the next day.
The same preparations were made. The third morning (see a theme here?), the elephants and the army were rushing toward the Jews and the crowds were cheering, as 3 Maccabees 5 ends on a cliff hanger.....until next time!
Now when the animals had been brought virtually to a state of madness, so to speak, by the very fragrant draughts of wine mixed with frankincense and had been equipped with frightful devices, the elephant-keeper entered at about dawn into the courtyard—the city now being filled with countless masses of people crowding their way into the hippodrome—and urged the king on to the matter at hand. So he, when he had filled his impious mind with a deep rage, rushed out in full force along with the animals, wishing to witness, with invulnerable heart and with his own eyes, the grievous and pitiful destruction of the aforementioned people. - 3 Maccabees5:45-47
The final paragraph is that the Jews dropped down in prayer to God.