In the past, airline pilots were required to eat different types of meals to one another. This was to ensure that if one type of meal was contaminated, and a pilot fell ill due to food poisoning or an allergic reaction, the other pilot would still be able to fly the plane.
However, this is no longer a requirement that is enforced in the aviation industry.
Q: Airline pilots have to eat different meals, true or false?
A: False
Why did pilots have to eat different meals?
The reasoning behind this requirement was primarily related to the potential for pilot incapacitation due to food poisoning. This was a real concern in the early days of commercial aviation, when food hygiene standards were not as rigorous as they are today. If both pilots ate the same meal and became ill, there would be no one left to operate the aircraft safely.
To mitigate this risk, airlines required their pilots to eat different meals, thus reducing the likelihood of both pilots being incapacitated at the same time:

In addition to food poisoning, there was also some concern about allergic reactions. Differing types of nuts, shellfish, or even pollen can cause severe allergic reactions, known as anaphylaxis, requiring emergency treatment.
While pilots that had severe allergies would obviously try to avoid food containing their specific allergen, worries about cross-contamination during both the processing and handling aspects of airline food, meant that pilots were advised to have different meals.
Around 4% of the adult population has a severe food allergy, so in the very rare chance both pilots had allergies, and they wouldn’t eat similar dishes, lowering the contamination risk.
What’s changed?
With modern food hygiene standards, the risk of food poisoning onboard an aircraft has been greatly reduced.
In addition, a series of high profile — and occasionally tragic — allergen incidents on aircraft have forced airlines to strictly label any allergens or likely cross contaminants, so the allergen risk has also been mitigated.

Why has the risk reduced?
Summary
In conclusion, while it used to be a requirement for airline pilots to eat different meals to reduce the risk of pilot incapacitation due to food poisoning or allergic reactions, airlines began to phase out this requirement around 10 years ago.
Improved food hygiene standards, temperature controlled storage, and detailed allergen advice has reduced the risk to an acceptable level for both pilots to eat the same dish.
While some airlines may still have legacy rules in place, including staggered eating times for their pilots, these are largely redundant.