There's a reason for each one of the steps, and things can be denied at any one of the steps. If an approved petition guaranteed a visa, then they might as well get rid of the visa application process and allow people to enter the US by showing an approved petition.
The petition only establishes the petitioner's eligibility to petition the beneficiary. This mostly includes the petitioner's citizenship and relationship to the beneficiary.
The visa application establishes that the beneficiary is eligible for the visa. This includes, but isn't limited to, the issues in
INA 212 regarding things like drug use, criminal history, etc. Also, at the visa interview, they may re-visit some issues about the petition approval, such as the bona fide nature of the relationship between the petitioner and beneficiary. If problems are discovered regarding the petition approval, it will be sent back to the USCIS for reconsideration. From reading these boards for awhile, my rough feeling is that the vast majority of denials happen at the consulate, not at the petition approval phase.
Even after a visa is approved, that is NOT a guarantee of eligibility to enter the US. If the customs officer discovers evidence that the beneficiary is not eligible for the visa, or has become inadmissible, then they will refuse entry at the POE. This isn't very common, but it happens. Being caught attempting to smuggle drugs into the US might be one reason. Another might be a K-1 beneficiary where there was evidence they got married sometime before entry to the US.