Is Open Source software illegal?

No it is not illegal.  Open Source software is release under license like any other software.  The difference is the freedom from excessive restrictions on its use, modification and visibility of the underlying code.  Visit www.gnu.org for information on one of the various types of open source license. Also visit the Open Source Initiative which contributes to Open Standards and related issues.