If it is another OS then how was the first OS made?
The short version is this:
- elementary is based on Ubuntu.
- Ubuntu is based on Debian.
- Debian was one of the first Linux distros.
Each distro takes the foundation laid by the previous one and uses it to build something new.
For the long version, see the history of Linux and the first ten years of Ubuntu. For more on how elementary OS came to be, see Wired's article on elementary OS.