Does congestive heart failure on right or left lead to swollen feet and ankles? Why?

Yes. Right sided heart failure (which is often present in combination with left heart failure) does. Blood returning to the right ventricle backs up, overfilling the inferior vena cava and all veins draining into it. Hormonal changes in the kidney cause fluid retention further engorging dependent tissues (mediated by gravity). This is a simple explanation: whole books have been written about this.
It can. Left side occures because when the leftside fails it causes a back up of fluids into the left atrium and then the lungs. The increased pressures in the lungs then causes the rt side to fail which causes fluids to engorge the liver and lower extremities. If its rt sided only then the lungs will be clear but the liver and legs can still be engorged.