False premise. Sydney never "overcame competition from Melbourne" to become national headquarters. The capital selection process worked differently:
Rivalry between the two largest cities deadlocked the decision. The Constitution (Section 125) mandated the capital be in NSW but ≥100 miles from Sydney. Canberra (in the Federal Capital Territory, now ACT) satisfied this.
Canberra: Purpose-built capital (~470K). Sydney: Largest city (~5.3M), economic hub. Melbourne: 2nd largest (~5.1M), cultural/sporting capital. Neither is the political capital.