Git is the underlying code management and version control system. It can be used directly, and also forms the backend to a number of other systems.
Code "forges" are platforms which integrate a version control system (like git), a code repository (a file server), and front end utilities.
Some git forges are open source, others are proprietary. Certainly with the open source ones, but also with the proprietary ones in some cases, you can either self-host or use a hosted service.
GitHub is a proprietary forge, and GitHub.com is the company's fully hosted service. They're now owned by Microsoft.
Gitlab is an open source forge. Gitlab.com offers a hosted service, but many projects self-host.
Forgejo is a fork of Gitea which is a fork of Gogs. These are all also open source. As far as I know, neither Forgejo nor Gogs offer a hosted version, but Gitea does.
A few other notable forges include GNU Savannah (open source), Bitbucket (proprietary), Sourceforge (proprietary), Launchpad (open source), Allura (open source).
At the end of the day, they all do the same thing. They have different feature lists (especially around some of the project management and user interaction side), different user interfaces (some are shinier and more modern, others more minimalist), and different communities and support models. You choose that one that works best for your needs.
GitHub is probably the most feature-rich (and/or bloated) of them. GitLab is competing in the same space, and self-hosted GitLab seems to be something of a sweet spot for many projects that want a premium experience without needing to use a proprietary Microsoft product. I don't have much experience with Forgejo or Gitea. The rest tend to exist in their niches.