A proximity sensor is a sensor able to detect the presence of nearby objects without any physical contact. Suppose you are playing music on your phone, and you receive a call. The sensor detects the distance to surfaces (cheeks and ears), and it can pause whatever activity it is in the middle of (playing music or browsing the web, for example) so the user can take a phone call. When the phone is removed it automatically resumes its previous activity.
The gravity sensor works when you enable the auto rotate feature on the top of the screen, the screen automatically rotates when you topple the phone.