It looks like you are a beginner to GitHub so let me explain in layman terms so that you can understand it better, let's understand it with a simple example. Suppose that you and your friend are doing the same project. So, if the half code is written by you and the other half by your friend. And both of you need to submit the completed project to your teacher. How do you do that? One answer can be you can take a pen drive and copy your code thereafter that you go to your friend’s house, then you copy your code from the Pendrive to your friend's computer. Then you have a single completed project. And it is possible that there will be some errors because both you and your friend have named the same variable as some other name. So, again you both will need to pull out your hair and spend some more hours and get it working.
Now consider the same situation with an IT company where 10people works in a project. Then how difficult it will be.
In this scenario, GitHub comes to your rescue and How it does it is?
You can create the main class and upload your project online to GitHub.
Your friends and co-workers can download your project and starts working on it.
You and your friends/co-workers upload your works’ to GitHub at a different time. So, GitHub always has the latest working code.
Always before uploading your work you pull down or download the latest code from GitHub on your machine the same project folder, of course, your local changes are kept safe. So, you have the latest working code.
Let's suppose a situation comes and a day before the exam, your computer crashes in that case you do not need to worry. You have the complete format of your computer, download the latest code from GitHub and give the finishing touches.
If you are an absolute beginner or you have a little knowledge of GitHub in that case to learn GitHub and all its concepts such as pull request or creating a repository in detail which is necessary for a programmer you can learn it by taking up the GitHub training course. If you like to read then you can have a look at the GitHub tutorial. If you want to learn it by watching the video tutorial then you can have a look at the following tutorial:-