Git is a source code version control tool. Even for single-user teams, version control can be very useful for avoiding losing big amounts of information (i.e. I accidentally deleted a file, no worries I can revert), reverting bugs, finding where a bug was introduced by jumping between different versions, keeping track of history, etc.
GitHub is an online service that allows you to keep an
online backup of your git repository. If your hard drive suddenly dies, you still have the repo online as backup. And at the same time, it makes collaboration simpler since you don't have to setup your own server. That's all.
The difference with using e.g. Dropbox as an online backup is that Dropbox is not really prepared for multiple revisions, and isn't integrated with version control systems like Git or Mercurial. And it doesn't allow collaboration either.
Not to mention GitHub has paid private repos service.
the other 99% are simply giving away free code
There's a lot of "abandoned free code" out there that saved my ass multiple times. Therefore I contribute back by publishing my snippets too. Someone may find them useful, even if I never ever find out about it.
Furthermore, if you plan on getting a good programming job, sharing your work is a great way of showing your potential employers how good you are at programming.
Always code as if the person who ends up maintaining your code is a violent psychopath who knows where you live. Sharing promotes a mentality that helps preventing bad practices (i.e. "only myself will use this code, so I don't care if it's poorly written")