The answer is easy, and explains why the same thing happens to this day as happened at the city of Ephesus. You just have to read the entire context.
Keep in mind that chapter divisions & headings, verse divisions, even verse numbers are things that have been added to the Scriptures, God's word, by translators, printers, and publishers. The same for paragraph markings, punctuation, center references, inline comments, red-lettering and other things.
In the King James Version (and just a few others), it is nice that the printer also pointed out what words the translator added by setting them off in italic script. They added some words that they thought were necessary to convey the correct meaning in English. Strictly speaking, any of those words can be dropped while reading. Sometimes it is necessary to do so because the opinion expressed can be misleading.
At no time should you consider any of the added things authoritative. God's word is the authoritative source, always. It's His word, after all, isn't it?
Well, drop the chapter heading. Read backwards to find the context. Eventually you land at Acts 18:24 which explains exactly why they had not heard about the gift of holy spirit. It is because a man named Apollos is the one who had taught them as much as they knew. They were ignorant because Apollos was ignorant.
And a certain Jew named Apollos, born at Alexandria, an eloquent man, and mighty in the scriptures, came to Ephesus.
This man was instructed in the way of the Lord; and being fervent in the spirit, he spake and taught diligently the things of the Lord, knowing only the baptism of John.
It is a fact that the baptism in water (by John) had been superseded by a greater baptism in holy spirit (by Jesus Christ), and that it began on the day of Pentecost in Acts 2:1 (A.D. 28). It was prophesied by John himself that Jesus Christ would bring about the revolution (Matthew 3:11; Mark 1:8, Luke 3:16). His prophesy was confirmed particularly by the resurrected Jesus Christ in Acts 1:4 & 5 (as well as other places).
People can't go beyond what they are taught. Apollos enthusiastically taught them only what he knew - the water baptism of John.
As a matter of clarity, the word "baptize" means "to dip". You can dip yourself in water, mayonnaise, or ranch dressing. Far better would be to get yourself dipped in holy spirit by following the explicit instructions in Romans 10: 9 & 10*.
Acts 18, Verse 26
And he began to speak boldly in the synagogue: whom when Aquila and Priscilla had heard, they took him unto them, and expounded unto him the way of God more perfectly.
Wow, isn't that nice. Two believers, Aquilla and Priscilla, who has been with Paul, were able to get Apollos straightened out. Notice they did it privately. They did not embarrass this wonderful man before the church.
Verse 27 & 28
And when he [Apollos] was disposed to pass into Achaia, the brethren wrote, exhorting the disciples to receive him: who, when he was come, helped them much which had believed through grace: For he mightily convinced the Jews, and that publickly, shewing by the scriptures that Jesus was Christ.
Well, it would have taken some time for the new information to settle and become clear to Apollos. He likely would not have been immediately able to articulate the details of the new, better baptism, or what to do with it. There are many and various benefits that take time to study and learn. So: what more could he do for the believers at Ephesus? Not much at that time. So he moved on. You can read what he did where he went.
Thankfully, Paul came along and brought the believers in Ephesus up to speed.
Acts 19: 1 & 2
And it came to pass, that, while Apollos was at Corinth, Paul having passed through the upper coasts came to Ephesus: and finding certain disciples,
He said unto them, Have ye received the Holy Ghost since ye believed? And they said unto him, We have not so much as heard whether there be any Holy Ghost.
And he said unto them, Unto what then were ye baptized? And they said, Unto John’s baptism.
Which they had learned from the enthusiastic Apollos.
There you go, Paul came to Ephesus, where Apollos had just been, and had not adequately instructed the believers about the new and better baptism in holy spirit, which happens only in the name of Jesus Christ. As it turns out, God and Paul did this for "about twelve" men.
Acts 19: 4-7
4 Then said Paul, John verily baptized with the baptism of repentance, saying unto the people, that they should believe on him which should come after him, that is, on Christ Jesus. 5 When they heard this, they were baptized in the name of the Lord Jesus. 6 And when Paul had laid his hands upon them, the Holy Ghost came on them; and they spake with tongues, and prophesied. 7 And all the men were about twelve.
As a result, some great things happened at Ephesus. Paul spent two years and 3 months teaching people there. Everyone living in Asia heard the word of the Lord, both Judeans and Greeks. Totally awesome, the grace of God in abundance.
By the way, Apollos is mentioned again in Paul's first letter to the Corinthians (6 times) as well as in his epistle to Titus (1 time). He continued to be beloved by Paul and other believers. No doubt he got to spend some time with Paul, and get himself thoroughly educated. We'll get to see him at Christ's return.
Romans 10:9 & 10
That if thou shalt confess with thy mouth the Lord Jesus, and shalt believe in thine heart that God hath raised him from the dead, thou shalt be saved.
For with the heart man believeth unto righteousness; and with the mouth confession is made unto salvation.