Airline relayed parking assignment
When the plane starts its descent, an automatic ACARS AOC in-range report is sent to the airline's operations center, which then uplinks various arrival related information, including the terminal/gate/stand (where applicable) as soon as it's been assigned.