It is illegal. Modding Xboxes and PlayStation 2's, as well as unlocking phones. Completely illegal. It's like stealing satelite. It's still stealing, it's still illegal.
Modding gaming systems - You are making the system do things it would not normally do. It voids warranty and is illegal. Well, in the UK for sure -
http://www.theregister.co.uk/2004/07/21/ps2_mod_chip_win/
Unlocking phones - Most, if not ALL, wireless companies offer services to unlock your phone FOR A PRICE. By doing it yourself, you are avoiding services costs which is stealing and therefore is illegal. However..as brought to my attention in the article linked below, it depends on what you mean by "unlocking". There are different types, unlocking features, unlocking phones that have been locked by the service due to inappropriate activity or something or unlocking the phone to be able to change service providers.
Interesting read:
http://cellphones.about.com/library/bl_cf_unlock.htm