1 John ends on a very short note: Little children, keep yourselves from idols (5.21). Of course this message is one that is utterly ubiquitous in the Old Testament texts. Everywhere and at all times the LORD rebukes the idolatry of his own people, Israel, as well as that of the nations. False gods are denounced and the true divinity of YHWH alone is upheld. We might pose the question: why is idolatry such a dangerous thing? Why does God care about worshiping idols, if an idol is nothing at all?
One answer that won't do for me is that somehow God alone has the right to be worshiped, and he insists on this right for his own sake. The doctrine of divine aseity teaches us that God is entirely of himself; he exists on his own, he gives existence to everything else, and he needs nothing from no one. This means he doesn't need our worship and our devotion, either. It doesn't help him with anything, it doesn't complete him in anyway, as if he needed completing. Why would he ask for anything for himself, if he needs nothing?
(This is one reason why I disagree with Reformed theology which posits that God does everything for the sake of his glory. If he needs nothing, why should he seek his glory? I agree that God's glory is an element of his workings, but I don't think he is concerned with glory for its own sake. If God has a concern for glory, it is because he wants people to know about him and to seek him, for their sake. It is because he wants people to know him, to repent of their sins, and to be saved (1 Tim 2.4). More on this below.)
Neither do I think God insists on the worship of himself alone because it is just right that it be done, and that's that. I don't understand God as interested in the abstract obedience of moral principles for its own sake, simply because it must be done. This is because I don't believe in abstract moral principles that have nothing to do with the welfare of human persons and finite creatures more generally. It makes no sense to say that something is morally required, but that it doesn't contribute in any way to the actual well-being of the persons who fulfill the requirement, or that it doesn't benefit anyone.
I think John tells us in the previous verse why we ought not worship idols:
And we know that the Son of God has come and has given us understanding so that we may know him who is true; and we are in him who is true, in his Son Jesus Christ. He is the true God and eternal life (5.20).
I think God doesn't want us to worship any other gods because true life, true blessedness, true welfare, true shalom can only come through fellowship with the true living God. If YHWH alone is the true God and if life is found only in him, then worship of anything else will end is falsehood, in lies, and in death. God demands that we worship him because it is good for us to do so; in the context of the worship of the true God, we find life and shalom as God intended us to have it. This is because he teaches us how to pray, how to depend on God, how to forgive others, how to do good to others and not evil, etc. So God demands we worship him and seek fellowship with him for our sake.
Importantly, John here affirms this within a specifically Christian trinitarian context. He affirms that the Son Jesus Christ is "the true God" and the "eternal life," which echoes 1.2: this life was revealed . . . the eternal life that was with the Father and was revealed to us. In the context of the fellowship with the Father and the Son (cf. 1.3) we find truth and eternal life. Therefore we must not turn away to idols, and to any denial of the Son who is true God -- this will lead only to death and lies.