Deciphering Template Code for Creating Graphics on GlowScript

I’m using GlowScript to create interactive 3D graphics for a site. I think it’s a good idea to try to understand what all the code is doing first. All the JavaScript code for creating the graphics is supposed to be inside the following code:

;(function() {;
    async function __main__() {
        //Enter code for creating graphics here
;$(function(){ window.__context = { glowscript_container: $("#myDiv").removeAttr("id") }; __main__() })})()

I understand that the outer function is an immediately invoked function expression, so it will run without being called elsewhere. Also, myDiv is the div the graphic should be placed in, so the last line must at least in part be placing the graphic in the div. I also imagine an async function is used because GlowScript is generally used to create animations. However I don’t understand why there has to be a function inside a function, what the last line is really saying, and why it seems the id is being removed.
I’m very new to JavaScript, so code like this is quite foreign to me. Could you provide a bit of insight as to what is going on here?