Maybe, but these are primarily antithetical when density doesn't increase.
It's totally possible to have housing be "affordable" (i.e., condos, apartments in multi-unit complexes) and "a good investment" -- buildable land close to amenities/jobs/etc. rises in value, and so selling to a developer who will add more units on that land can net the owner a solid profit.
The contradiction appears when you want the same units (i.e., SFHs in perpetuity) to be both affordable and appreciate in value.