There are some aspects:
...is a tool to control the history of your code and to collaborate with other people on the same codebase. There are several tools for that, but git is very popular, and honestly just more powerful than subversion.
I would say knowing how to use a version control tool is essential knowledge for any programmer who wants to outgrow the solo hacker stage. And git is the best choice for version control.
It can be hard to get started with git. But there's a lot of material online.
Git is used to share code. For that it helps to have a central place where different people can reach the code. Github is one of those places where you can do so for free. It's probably the most popular one, but there are others (bitbucket, gitlab).
Making an account and getting started is pretty easy, after you have learned how to use git. Just register, make a project, and use git to send your code to github.
Github is commonly used for code that is 'open source'. This means that anyone can see and use your code. They may even help you with your project.
Whether this is something you want, depends. There are other topics about that: why open source is important / 12 reasons to contribute / what stops developers from contributing.
Note that Github can also be used without making your code open source! These days, it's free to make private (non-open) repositories for your projects (maybe not for commercial use? I'm not sure).
To summarize, Git is hard at first, but very useful. Github is easy once you know git, but is less essential - there are pros and cons.