Brittany Oswell suddenly felt ill about three hours into her flight from Hawaii to Texas. She was dizzy, disoriented and slurring her speech. Then she briefly fainted.

A flight attendant on the American Airlines flight in April 2016 tracked down a doctor on board who examined her. She may have had a panic attack, the doctor said. But it soon became clear her condition was far worse.

About an hour later, Ms. Oswell, 25, collapsed in a lavatory, defecated and vomited on herself, and threw up on flight attendants who had come to check on her. The doctor returned and this time issued an urgent request to the flight crew: The pilot must land the plane immediately.

The frenzied efforts by her husband and the doctor to save Ms. Oswell, who died three days later in a hospital of a pulmonary embolism, were detailed in a wrongful-death lawsuit filed this month by her family against American Airlines. The lawsuit alleges that the airline was negligent and ultimately contributed to her death because the pilot did not heed the doctor’s pleas to divert the plane and an onboard defibrillator and blood pressure monitor were faulty.