Even though the Law of Moses says that the priests must be descendants of Levi, those priests cannot make anyone perfect. So there needs to be a priest like Melchizedek, rather than one from the priestly family of Aaron.
The Law appoints priests who have weaknesses. But God's promise, which came later than the Law, appoints his Son. And he is the perfect high priest forever.