Deacons come from Acts chapter six, priests (elders) from Paul's letters to Timothy and Titus and bishops come from Paul's letters to Timothy and Titus as well as from church practise in the first and subsequent centuries.
Deacons
Acts 6:1-7 In those days, as the number of disciples was increasing, there occurred a murmuring of the Greeks against the Hebrews, because their widows were treated with disdain in the daily ministration. 2 And so the twelve, calling together the multitude of the disciples, said: "It is not fair for us to leave behind the Word of God to serve at tables also. 3 Therefore, brothers, search among yourselves for seven men of good testimony, filled with the Holy Spirit and with wisdom, whom we may appoint over this work. 4 Yet truly, we will be continually in prayer and in the ministry of the Word." 5 And the plan pleased the entire multitude. And they chose Stephen, a man filled with faith and with the Holy Spirit, and Philip and Prochorus and Nicanor and Timon and Parmenas and Nicolas, a new arrival from Antioch. 6 These they set before the sight of the Apostles, and while praying, they imposed hands on them. 7 And the Word of the Lord was increasing, and the number of disciples in Jerusalem was multiplied exceedingly. And even a large group of the priests were obedient to the faith.
1 Timothy 3:8-13 Similarly, deacons must be chaste, not double-tongued, not given to much wine, not pursuing tainted profit, 9 holding to the mystery of the faith with a pure conscience. 10 And these things should be proven first, and then they may minister, being without offense. 11 Similarly, the women must be chaste, not slanderers, sober, faithful in all things. 12 Deacons should be the husband of one wife, men who lead their own children and their own houses well. 13 For those who have ministered well will acquire for themselves a good position, and much confidence in the faith which is in Christ Jesus.
Priests/Elders
Titus 1:5-16 I left you behind in Crete for this reason, that you should put in order what remained to be done, and should appoint elders in every town, as I directed you: 6 someone who is blameless, married only once, whose children are believers, not accused of debauchery and not rebellious. 7 For a bishop, as God's steward, must be blameless; he must not be arrogant or quick-tempered or addicted to wine or violent or greedy for gain; 8 but he must be hospitable, a lover of goodness, prudent, upright, devout, and self-controlled. 9 He must have a firm grasp of the word that is trustworthy in accordance with the teaching, so that he may be able both to preach with sound doctrine and to refute those who contradict it. 10 There are also many rebellious people, idle talkers and deceivers, especially those of the circumcision; 11 they must be silenced, since they are upsetting whole families by teaching for sordid gain what it is not right to teach. 12 It was one of them, their very own prophet, who said, 'Cretans are always liars, vicious brutes, lazy gluttons.' 13 That testimony is true. For this reason rebuke them sharply, so that they may become sound in the faith, 14 not paying attention to Jewish myths or to commandments of those who reject the truth. 15 To the pure all things are pure, but to the corrupt and unbelieving nothing is pure. Their very minds and consciences are corrupted. 16 They profess to know God, but they deny him by their actions. They are detestable, disobedient, unfit for any good work.
Bishops
1 Timothy 3:1-7 The saying is sure: whoever aspires to the office of bishop desires a noble task. 2 Now a bishop must be above reproach, married only once, temperate, sensible, respectable, hospitable, an apt teacher, 3 not a drunkard, not violent but gentle, not quarrelsome, and not a lover of money. 4 He must manage his own household well, keeping his children submissive and respectful in every way-- 5 for if someone does not know how to manage his own household, how can he take care of God's church? 6 He must not be a recent convert, or he may be puffed up with conceit and fall into the condemnation of the devil. 7 Moreover, he must be well thought of by outsiders, so that he may not fall into disgrace and the snare of the devil.
Clearly there is overlap between the office of elder/priest and the office of bishop because every bishop is also an elder/priest. But the three offices are present in holy scripture and as the Church fathers wrote their letters in the later part of the first century and after they made it abundantly clear that the apostles left behind bishops to pastor the Church priests to help them in their work and deacons to see to the day to day care for the poor and other tasks in the church. Of course volunteers would assist the people in all three of the offices so church work was in the hands of the whole congregation not only in the hands of the office bearers yet the office bearers were the men chosen to lead and govern.