Start by opening Safari and going to its settings. You can do this by clicking on Safari in the Menu Bar, or simply by pressing "Command + ," (yes, the comma key). With Safari settings on your screen, look for the Tabs menu. The first option should be Organize Tabs. Select Automatically Create Topics to have Safari organize your tabs for you. Just close the settings window and the feature will be there waiting for you.
Now you can open as many tabs as you want (or as many as your Mac's RAM can handle) and they'll be automatically organized by topic. For example, if you open three or four webpages about GTA VI, the browser will likely create a "Video Games" group with all of them. Open three more articles with news about Taylor Swift, and well, you get the idea. It's all done using AI to understand the content of each tab. But don't worry, it's all processed on-device, so Apple isn't actually keeping tabs on your browsing history.
You might want more control over how you organize your tabs, but with a little help from Safari. If that's the case, go back to the Tab settings and select the "Show Related Tabs" option instead. That way, Safari will provide suggestions for tab groups, but won't group them automatically. It's a great balance between the mess of keeping lots of tabs open and having Safari do everything for you.