A cosigner is generally someone with a longer credit history and a track record of paying back what they borrow.
Rather than deny a loan, a lender may ask an applicant to get a cosigner so the loan can be approved. This usually means that the applicant has little or no credit history, or that they have had some credit problems in the past. Either one of these problems can cause the loan application to be denied.
A cosigner solves this problem for both the lender and the borrower. The lender is more comfortable offering the money, knowing that someone on the application has good credit so the loan has less perceived risk. The borrower gets approved for the loan with a decent interest rate, where otherwise they might be denied.