After landing an airplane is asked to vacate from a taxiway and is then handed over to the ground controller who controls surface movements. This controller assigns a gate depending on various factors and then tells the aircraft the taxi ways it should follow to reach it's gate.