From the docs:
If primary's session-timeout period is exceeded by a secondary
replica, the primary replica temporarily shifts into
asynchronous-commit mode for that secondary replica. When the
secondary replica reconnects with the primary replica, they resume
synchronous-commit mode.
Differences between availability modes for an Always On availability group
So after the timeout, the failed replica is switched to asynchronous mode, and the primary commits the transaction. The failed replica will eventually reconnect and receive the log record indicating that it should commit the transaction too, followed by all the log records while it was down. After it's caught up, it will switch back to synchronous-commit.
See eg Synchronous Always On Availability Groups Is Not Zero Data Loss
You can opt for having the primary fail to commit by setting REQUIRED_SYNCHRONIZED_SECONDARIES_TO_COMMIT on the AG.