If someone injects a malicious script (XSS), a well-configured CSP can block it, because the script doesn't come from an allowed source. It is rolled out carefully: first in report-only mode to see what it would block, and only then is blocking switched on.
In practice: Guide: how to secure WordPress, including security headers