With macOS, Apple allows for the automatic hiding of the menu bar. In versions of macOS prior to Big Sur, the setting to turn this on or off is located in the General system preference.
But in Big Sur, Apple has moved the setting. It is now located in the Dock & Menu Bar system preference. To set the menu bar to hide and show when move the cursor to the top of the screen, check the box.