What is the basis for King Melchizedek actually being Jesus? Where did this idea come from? I have heard people state that King Melchizedek was actually Jesus.

What is the biblical basis for this idea? Where in church history did this idea begin?
The chief basis for the belief is Hebrews 7:3, which says in the NET translation:


  Without father, without mother, without genealogy, he has neither beginning of days nor end of life but is like the son of God, and he remains a priest for all time.


Those who argue that he is Jesus say that a plain reading of the verse is that Melchizedek literally had no parents or ancestors, and that he never died and is eternally a priest.

Others would counter it by saying that he was a type of Christ, and that Hebrews is calling attention to his mysterious, spontaneous appearance in Genesis: no genealogical record, no record of his life beyond his interaction with Abraham. They also point out that Hebrews says he was made "like" the Son of God, not that he was the Son of God, which is a title that Hebrews reserves for Jesus.

As supporting evidence, proponents of the "Melchizedek = Jesus" view point out that only a few chapters after Abraham's encounter with Melchizedek, he meets someone who has traditionally been identified as a manifestation of God. So such encounters were not unheard of.

The origin of the belief is murky, but it seems to have been a minority opinion in relatively early times, and remains so today. It seems to not have a lineage per se, but rather that commentators and theologians arrive at the conclusion independently at different times. Its earliest mention that I could find is the fifth century.

According to Philip Edgecomb Hughes' commentary on Hebrews, Jerome asserted (in letter 73, to Evangelus) that Origen believed Melchizedek to be an angel and that he himself along with Irenaeus, Hippolytus, Eusebius of Caesarea, Apollinaris, and Eustathius believed him to be a human being and a type of Christ. Hughes adds Cyril of Alexandria and Epiphanius to the list. But Ambrose (according to Hughes) sometimes referred to Melchizedek as God, sometimes the Son of God, and sometimes a type of Christ. Epiphanius was an early writer who explicitly wrote against the idea of Melchizedek being a theophany; John Brown also mentioned that he was aware of the belief. Hughes identifies Cunaeus as a more recent proponent of the belief, along with J.B. McCaul and A.T. Hanson, about whom not much information is out there online. In addition to all this (just as a side note) there were various heretical sects that saw Melchizedek as a manifestation of the Holy Spirit, and Jewish writers commonly identify Melchizedek with Shem.