Some minor additions/corrections to Tsarren's excellent writeup. Submarines have multiple passive sonar systems (also called hydrophones). Some are kept in a towed array which can be isolated from the noise produced by the submarine itself, and also can thus be used to listen in what are called the submarine's baffles - the area masked from the boat by the disturbance of its own propellor. Some are mounted on the hull itself.

Torpedoes may use either active or passive sonar or both, depending on their type. While most ASW torpedoes use active sonar for their terminal mode, they are usually fired and initially guided using passive sonar data so as to avoid cluttering the area with sonar energy which would blind its launcher. In addition, there is a chance (especially if your target submarine is moving) that they may not hear the noise of the torpedo, which is guaranteed impossible if it is active. Up until they reach the limit of their controlling wires, they can either run active or be guided by information from their launcher; once they have a good location on their target, they usually go and remain active so as to not lose it.

In addition, wake-homing torpedoes use passive sensors to listen for the sound of enemy ship's screws, and 'follow up the wake' of said ship. They are a cheaper weapon designed to attack surface (usually merchant marine) shipping, which does not have the active or passive defenses of an enemy submarine or warship.

Finally, some newer sonobuoys can be used to simply relay a simple hydrophone signal, meaning they do in fact use passive sonar as well as active. This is not common, though, unless you are simply looking out for submarines. Usually if you're using sonobuoys you're trying to kill one or more of them, and since sonobuoys are usually airdropped you're not too worried about counterattacks. This may change, as navies are investigating the possibility of installing MANPADS-based light anti-aircraft systems on submarines in order to deter adversaries from heavy use of helicopters or allow the submarine to engage ASW helos in order to escape.