TIME has a nice story discussing how it came about:
The iPhone developed the way a lot of cool things do: with a notion. A few years ago Jobs noticed how many development dollars were being spentparticularly in the greater Seattle metropolitan areaon what are called tablet PCs: flat, portable computers that work with a touchscreen instead of a mouse and keyboard. Jobs, being Jobs, figured he could do better, so he had Apple engineers noodle around with a better touchscreen. When they showed him the screen they came up with, he got excited. So excited that he thought he had the beginnings of a new product.
Two and a half years ago, Jobs sicced his wrecking crew of designers and engineers on the cell phone as we know and hate it. They began by melting the face off a video iPod. No clickwheel, no keypad. They sheared off the entire front and replaced it with a huge, bright, vivid screenthat touchscreen Jobs got so excited about a few paragraphs ago. When you need to dial, it shows you a keypad; when you need other buttons, the screen serves them up. When you want to watch a video, the buttons disappear. Suddenly, the interface isn’t fixed and rigid, it’s fluid and molten. Software replaces hardware.