Subtitling has many advantages: It allows for an extremely accurate translation (including quirks of the original language that
play a role in the plot), while allowing you to hear the original actors' performances. It renders the show accessible to the deaf or hard of hearing. People bilingual in or learning the original language will be able to benefit as well, since they can enjoy at least parts of the film/TV show in the original while their friends can still know what's going on. In addition, it's much less expensive than creating a new
Automated Dialogue Recording and dodges
Lip Lock; fans have been capable of producing serviceable
Fansubs using home computers for decades, and it's possible to subtitle a program with literally nothing more than a time-coded script. Hence, subtitled anime has a much wider potential reach simply because it is easier to produce and the licensor can turn a much larger profit on the smaller cost. Furthermore, in today's severely damaged anime market, more and more titles only come out subtitled because it's flat out the only way to release them to a profit in the first place.** On the other hand, dubbing a program means that the audience doesn't have to read the dialogue while watching the show.
While this is frequently used as an insult to the intelligence of dub-watchers (lookin at YOU), subtitlers in some languages (including English) do trim dialogue due to subbing line-length restrictions. (This is not just a translation problem - turn on the native language subtitles for a DVD, and you'll often witness subtitle abbreviation, spanning from a noticeable to a horrendously significant degree. If an example is necessary, try
Real Genius.)