How we know that God is good and not evil?

I didn't know evil was a living being

What did you not "know" lol?

2 Kings 2:23-24
Then he went up from there to Bethel; and as he was going up by the way, young lads came out from the city and mocked him and said to him, “Go up, you baldhead; go up, you baldhead!” When he looked behind him and saw them, he cursed them in the name of the LORD. Then two female bears came out of the woods and tore up forty-two lads of their number.

god can do evil whenever he wants and how he prefers

How so?

so you can kill children if they insult you?

Ask a bear, not me. Eli just cursed then in the name of the Lord. Doesn't even say that the Lord sent the bears either.

he had the authority to stop it anyway if he wanted

How would you have stopped it?

Evil is the lack ot absence of a given perfection (goodness).

God is pure act (see first way) and thud has all perfections in act.

If God has all perfections, that means he can't lack goodness and thus can't be evil.

if I was god I was able to do it