“I will build my church; and the gates of hell (Hades) shall not prevail against it.”
When Jesus said that to Peter in Matthew 16:18, He was referring to the work He came to accomplish on the cross by His Father’s will.
Before the fall, Adam had fellowship with God, and God gave Adam dominion over His creation. When Adam decided to disobey God, he fell from grace and into sin. He surrendered the dominion God had given him to Satan, and Satan became the prince of this world.
After the fall, the whole human race continued being born in sin and destitute of spiritual life. Man became subject to death, and Satan became the Lord of the dead in Hades. He acquired the key of Hades, and the power to keep everyone who died, captive in his dominion.
After Adam’s fall no one of his own volition, would ever be able “to seek after God” and know Him. God had to seek a people for Himself and that’s why He sent Christ to redeem His people from the power of death and of the devil.
Before the cross, all who died, saints and wicked alike, went to Hades. They were separated, in different rooms, but still locked beyond the gates of Hades.
Christ died and went to Hades and opened the gates and took His people out, once for all. He was the One that came to open and “nobody can shut”. He took the keys of Hades and death. (Rev. 1:18)
He took His people from Hades to Paradise, or heaven, the place that He came to prepare for His people in His Father’s house (John 14:2) (Mat. 27:52-53)
After the cross, in the New Covenant, all the believers who die go to Heaven to be with the Lord and his fellow saints. Still, Hades, or hell, remains as the place where all who are not of Christ will go after death, to be tormented forever and ever.