An XA transaction is one branch of a transaction spanning several resource managers, such as two MySQL 524 servers. It follows the X/Open XA two-phase commit: a transaction manager sends XA PREPARE to every branch (the work becomes durable but undecided), then XA COMMIT once all have prepared, or XA ROLLBACK if any failed. A branch runs between XA START 'id' and XA END 'id'; only InnoDB supports XA.
Since MySQL 8.0.29 a prepared branch is detached from its connection (xa_detach_on_prepare, on by default), so it survives a disconnect and any session can finish it: in a test run, Session B saw Session A's prepared branch in XA RECOVER and committed it with XA COMMIT. A prepared branch keeps its row locks until someone decides its fate. XA is unsafe for statement-based replication, and detached XA transactions cannot use temporary tables. PHP applications rarely need XA: keep related data in one database, or write an outbox table in the local transaction and deliver its messages afterwards.