The UN is simply a forum for countries to meet and discuss international affairs. It is not a global governing body, and wields no power not authorized by its constituent member nations.
This is an important distinction and to understand why, it's helpful to read about its predecessor, the League of Nations which due to mismanagement failed spectacularly in its goals to prevent conflicts between nation states.
In The Expanse (great sci-fi novels that just got a new TV season last week), the UN becomes the governing body of Earth after some climate-related disasters that individual countries could not or would not handle (I think).