It's widely used when the recipient's name or title is unknown, such as when you are providing a recommendation for a former colleague and do not know the name of the hiring manager.
When you don't know the name:
You should still start your cover letter with a greeting even if you are unable to discover somebody to address it to. The best salutation for a cover letter is "Dear [job title]." If you address your cover letter as "Dear Hiring Manager," it will be received immediately and will demonstrate your interest in the position almost as effectively as if you used the Hiring Manager's actual name. Using "Dear Sir or Madam" is also a wise move because it conveys urgency and respect. Due to their directness, both of these options are preferable to "To Whom It May Concern."
In addition, "To whom it may concern" is a really old expression, and you don't want to appear to be blindly adhering to convention in the context of a cover letter.
Since you have more possibilities than just "To Whom It May Concern," you can relax knowing that there is a great salutation for your particular circumstance. Even the most media-averse employees leave internet footprints, so you should still conduct a search on LinkedIn, the company website, and even Twitter before calling your receiver anonymous. In the end, you might not always be able to find the recipient's name, but at least you now have a few strategies to use to navigate that unpleasant nameless terrain.