What I think main() function does

I think the main() function is a piece of code that groups the main game into one category.

I think you are a little bit overthinking this. Main() function is just code that runs first when your program starts

main() is a function called when the program starts to run.