I've been asked about this a couple of times, so decided to write it up here.
Android runs on Linux - a Unix-like operating system - including the all-powerful user named "root". To break into a Unix system means to gain access to that account. Since Android phones aren't normally shipped with that access, you have to violate the security in some way to get it, hence you've "rooted" the phone. Doing so lets you re-arrange the system in ways that someone along the way probably didn't want you to. A second level of extra access to Android phones is unfortunately known as "unlocking the boot loader" - the point of that being to install an Android build other than those approved of by whoever gave you the phone. For some Android phones, this is no big deal - you can already install pretty much any build. Developer phones even come with a command to let you change the boot loader. The general reason for doing this is to install a system that has the changes you'd like to make as root already built into it, so you don't have to do them all by hand.
iPhones run iOS, which is also based on a number of different Unix-like systems. Initially, they just ran everything as root - you had root access by default. However, Apple also employed a form of Digital Rights Management (DRM) - in spite of the fact that they know DRM has never worked - to keep users from running programs that Apple deemed "undesirable". To circumvent that, you have to install a new version of the system - also circumventing the security in the boot loader. However, iPhone's can also be "unlocked" (hence my use of the word "unfortunate"), which means allowing the phone to be used on other carriers. This usage predates smartphones, since cell phone companies like to "lock" their discounted phones so they can only be used on their service. Unlocking an iPhone allows it to be used on any compatible carrier. This generally isn't an issue for Android, as most carriers offer reasonable-quality android phones.
Ok, why do you want to do these things? With an iPhone, it's usually go get some application that Apple doesn't think anyone would want or should have. I.e. - I initially jailbroke my iPhone to install an ebook reader, since at the time Apple believed nobody would read, and that we'd be happy with web apps - 0 for 2 on those - and a web app is about the worst possible way to read an ebook. Later, when the applications became real, I wanted to multitask some of them, but Apple - in retrospect correctly, as the hardware and software of the time couldn't make this as smooth an experience as Apple wanted - didn't think users should be allowed to do that. Even after that was fixed, I still wanted to sync my iPhone to two different macs: the one connected to the TV for videos, and my laptop for music and contact information. Other reasons might include wanting a soft keyboard that apple didn't provide, or a better home page handler, and so on.
For Android, those reasons don't really apply - there have always been applications, and there have seldom been restrictions on legitimate applications, or for adding any other piece of software that might plug into the system: alternative home pages handlers, keyboards, etc. No, the reasons for rooting an Android phone are to get around restrictions that the provider may have put in place - like only being able to install apps from the Android market. But more commonly, it's a performance issue. The first generation of Android phones didn't allow applications to be stored on the SD card, but with root privileges you could do that anyway, thus saving on memory. Custom kernel builds more tightly coupled to the hardware provided better performance. They might even include updates the provider wasn't willing to support on the phone. For Android, you should root your phone - and probably install a custom build of Android - only if your phone's performance is a problem.