Y es, your iPhone has an accelerometer. I know this is not a physics class but the best way to define it is saying that it is a device to detect the magnitude and direction of acceleration. iDevices uses it to detect rotation, shake gestures, among others.
Read the full article at: How to make an iPhone App – Part 5: The Accelerometer
Reading Accelerometer Data
Switching to Landscape Mode
The previos part is at: How to make an iPhone App – Part 4: Navigation Controller