Melchizedek came out to meet Abram, after Abram, along with with 318 men who he had trained, had defeated five kings in the Vale of Siddim. The battle was fought to rescue Abram's nephew, Lot and his household. It is noteworthy that Melchizedek came out to meet Abram rather than Abram seeking out Melchizedek. Melchizedek was a king and priest, unlike the later Levitical priests who were separate from royalty. Melchizedek came from Salem, which was later called Jerusalem.
The writer to the Hebrews declares that Jesus Christ is a Priest after the order of Melchizedek, because God has sworn it (Psalm 110:4). The writer shows that the Levitical priesthood was only a type or shadow of the priesthood of Christ, who won the victory over death.