Jailbreaking is a way to remove various restrictions and includes an app called Cydia, which is an alternative app store that has a large amount of apps that aren't available on Apple's App Store. This includes games, emulators, new themes, and a lot of other useful stuff. If it weren't for jailbreaking, I'd be using a galaxy 4. See www.jailbreaknation.com for more info. Also, it is not illegal.
Basically customizing your phone. It's best to do this on an iPhone that is of newer releases such as 4 and or 4S or 5. Cydia is the common software used on jail broken phones. If your phone starts to act up ( before jailbreak back up your phone to computer ) plug it in and restore.
Jailbreaking isn't just for iphones... any device can get jail broken.. its just on the iPhone you get cydia... Jail breaking allows you to do more things then what your device is capable of doing ....another name for jailbreak is Root.