It’s important you remember that the passport you show the airline does not need to be the passport you show to exit passport control.
You should show the airline (when filling in API information online, during check-in, at the gate) the passport you intend to use when entering the destination country. What they are interested in is:
- that you are who you say you are - either passport would do
- That you are allowed to enter the destination country, based on citizenship, any visas or resident permits, or ETA/ESTA-like systems.
This is the information they will be submitted via API/APIS-like systems to the destination country, and which may result in Board/Do not board decisions for systems which implement it.
On the other hand, you should show exit passport control the passport which is relevant to exit the country you are leaving, most likely the one you used to enter, as this will allow them to match records and/or input stamps, and allow them to decide whether you were legally present in the country, did not overstay, etc.
If you show them a different passport, depending on the combination of countries (the one you are exiting, the one for the passport you present…) this could raise eyebrows as in “can’t find the entry stamp” or “can’t find your record”, etc.
There are a few peculiar cases, such as countries which do not have explicit exit controls (like the US or UK) where whatever you give the airline will also be sent to the authorities of the country you are leaving. They apparently have some way of matching your record for that case (but if you’re a foreigner in that country, it’s good to check that your records are properly updated, like your I-94 in the US).