The 35-year-old midfielder fell to the ground just as he was about to be replaced by Marc Fitzpatrick near the end of Motherwell's 5-3 victory.
O'Donnell was treated for around five minutes on the field before being taken to a waiting ambulance.
The club later confirmed the player had died.
Motherwell manager Mark McGhee said O'Donnell's substitution had been "an absolute coincidence" before his sudden seizure.
"We just felt we would save him a bit for Wednesday," he said.
Scottish Football Association chief executive Gordon Smith led tributes to the player.
"This is absolutely devastating news," he said.
"Phil was not just a wonderful footballer, he was a great human being.
"My thoughts are with his family at this tragic time." O'Donnell's nephew, David Clarkson, was substituted moments later after scoring two goals in the Scottish Premier League match.
McGhee said: "We took Clarkson off because he got a fright from the nature of the collapse.
O'Donnell, who earned one cap for Scotland, also played for Celtic and English club Sheffield Sheffield Wednesday.