McDonald’s Corp. said it has fired Chief Executive Steve Easterbrook because of his consensual relationship with an employee, the latest challenge for the company as it races to keep up with changes reverberating throughout the food industry.

The burger giant said Sunday that its board voted Friday to terminate Mr. Easterbrook after investigating his relationship with the unnamed employee. Mr. Easterbrook resigned from McDonald’s board as well. He wrote in an email to McDonald’s employees on Sunday that he had violated company policy on personal conduct.

“This was a mistake,” Mr. Easterbrook wrote in the email. “Given the values of the company, I agree with the board that it is time for me to move on.”

A representative for Mr. Easterbrook said he is grateful for his time at the company and has declined to comment further. McDonald’s said in a filing on Monday that it would pay Mr. Easterbrook 26 weeks in severance.

The board was alerted to the relationship, conducted a thorough investigation and acted swiftly, according to McDonald’s. The company declined to provide any other details.