Different people have different ideas about what a cover letter is for. It can be used to explain things not evident on your resume, such as a gap in employment history; it can be an opportunity to name drop connections at the company who recommended you apply; or it can expand upon particularly impressive accomplishments in your resume.
But from the hiring side of the desk, none of these points get at the main things I'm looking for when I read someone's cover letter.
Your cover letter is an opportunity to tell a single, coherent story. It's a story that answers one main question the hiring manager can't get anywhere on your application: Why are you applying for this job?
The trick? The answer to that question should always include one or two main reasons why you would be an excellent fit for the position. You are applying for the job both because you are interested in this specific job and because you know you would be able to do it exceptionally well. (Or you're going to pretend like you know that.)
A resume is all about you and your background, albeit a carefully edited version of your background meant to demonstrate that you have the skills and experience for the job. A cover letter is the only opportunity you have to talk about the company or organization and the specific position you're applying for. You don't just want any job — you want this job, at this company.
Why? Because your past experience (which, it so happens, has superbly prepared you for this new role) has shown you that this is the kind of work you love to do.
Most qualified people applying for the same position are going to have resumes that look somewhat similar to yours. Your cover letter is your chance to separate yourself by telling your story. It's your opportunity to communicate that you're not just qualified for the role — you really get it. You get what this company or organization is trying to do, you get why this position plays an important role in that goal, and you get what skills are most important for doing the job well.
That's what the hiring manager wants to know, and the cover letter is your chance to showcase it.