Intel Corp. said Chief Executive Brian Krzanich resigned for violating company policy by having a relationship with a co-worker, one of the most prominent CEOs to lose a job in an era of greater scrutiny over workplace behavior.

Intel learned of Mr. Krzanich’s relationship in the past week from an employee who raised concerns, according to people familiar with the matter. The company said an investigation by internal and external counsel into what it called “a past consensual relationship” confirmed a violation of its nonfraternization...