Linux came about through a series of happy coincidences. If you've never heard the story before, I'll give you the nutshell version.
Back in the late 1970's a computer programmer named Richard Stallman was working at MIT. He needed to get inside a software program and make a correction or two in order to solve a problem. But, the software manufacturer wouldn't allow this. They had a license that prohibited this sort of thing. That's when the inspiration for creating the Open source movement and software hit him. He decided to write his own operating system and make it freely available to anyone who wanted it.
Unix was the operating system Stallman was using at MIT, so he went about writing an OS modeled on Unix. He called it GNU. GNU stands for GNU's Not Unix. A recursive acronym that helped him drive home the point that no Unix code was being used and that his operating system was not Unix.
So he went about building his operating sytem a chunk at a time. he also created the GPL or, General Public License, which allowed him to give away his creation to anyone who wanted it. This is sometimes referred to as Copyleft.
Fast forward a few years. A young computer science student at the University of Helsinki named Linus Torvalds was creating his own operating system. He called it Linux and, using the GPL, made it available to the world. Now, this is one of the happy coincidence parts...Someone, somewhere, grabbed Linux and plugged it into GNU. Linux was the missing piece GNU needed. The two become one whole usable operating system. What we call Linux is really GNU/Linux. But somehow over the years, folks simply settled on calling the OS Linux.
If you're interested in knowing more of the story and meeting all the characters, I highly recommend the documentary Revolution OS.