There are 3 types of references:
The purpose is to confirm that you actually worked at the company in the position that you are claiming when you claimed to work there. People do fake their resumes and this can weed out some of the fakes.
The purpose of this is to find a peer or supervisor that you have worked with that will talk to the quality of your work, and your work ethic. In a professional setting this is the reference that usually means the most.
This is someone who knows you that is willing to vouch for you. The idea is that if someone is going to vouch for you they are willing to have you work with them. Ideally this type of reference should be someone that the reviewer knows and respects. We like to say "it is what you know not who you know" but the reality is most of the time that is false. If you know the right person you have an edge, in many cases, over someone of similar or even slightly better skill set.
The reason these are important is that your past performance is usually indicative of the type of performance that can be expected in the future. So having good references is important. The more recent the better.