This mode is a semi-automatic mode where you choose the aperture and where your camera chooses the other settings (shutter speed, white balance, ISO etc) so as to ensure you have a well balanced exposure.
Aperture priority mode is useful when you’re looking to control the depth of field in a shot (usually a stationary object where you don’t need to control shutter speed). Choosing a larger number aperture means the aperture (or the opening in your camera when shooting) is smaller and lets less light in. This means you’ll have a larger depth of field (more of the scene will be in focus) but that your camera will choose a slower shutter speed. Small numbers means the opposite (ie your aperture is large, depth of field will be small and your camera will probably choose a faster shutter speed).
Shutter priority is very similar to aperture priority mode but is the mode where you select a shutter speed and the camera then chooses all of the other settings. You would use this mode where you want to control over shutter speed (obviously). For example when photographing moving subjects (like sports) you might want to choose a fast shutter speed to freeze the motion. On the flip-side of this you might want to capture the movement as a blur of a subject like a waterfall and choose a slow shutter speed. You might also choose a slow shutter speed in lower light situations.
Some digital cameras have this priority mode in addition to auto mode (in a few cameras Program mode IS full Auto mode… confusing isn’t it!). In those cameras that have both, Program mode is similar to Auto but gives you a little more control over some other features including flash, white balance, ISO etc. Check your digital camera’s manual for how the Program mode differs from Automatic in your particular model.