I don’t know that I can explain it but perhaps add a couple of pieces of information-
the “children” in the story are not schoolboys. The word rendered “boys” here is the same one used in 1 Kings 20:15 when they are mustering an army. And if 42 of them were killed, there were presumably considerably more in the group – this is a sizeable gang, in other words, taunting the prophet as he is travelling between cities.
Elisha defends himself with the only weapon he has - his words, which are consecrated to God. And the fact that his curse results in an immediate effect rather than a remote one may have served as a warning to others, as proof that Elisha was in fact a true prophet. (Many people have observed that by taunting Elisha they are taunting God - I don’t know that this is necessarily true, but we certainly know in our own day that those who reject God frequently taunt or vilify those who strive to serve Him.)
Given the popularity of bear-baiting as sport in ancient and medieval time, and the kinds of activities that gangs of marauding youths have been known to come up with in centuries past and present, I think it’s quite possible that those two bears had a previous grievance with those boys.