Yes, polish works by removing light scratches and swirl marks.
Compound polishes tend to be more effective at removing paint defects due to the abrasive properties. More often than not a follow-up treatment like wax or a treatment polish is required after applying compound.
All-in-one polishes tend to be less abrasive and therefore more forgiving when mistakes are made. They can also have protective properties that act as a wax would in providing good shine and protection.