"The gates of hell shall not prevail against it" has generated vivid imagery, but the underlying expression deserves careful attention. Matthew uses Hades, the realm of the dead, rather than the word Gehenna.
Gates were also a natural image of a city's strength and enclosure. Together the terms create a picture of the power of death unable to overcome what Jesus is building.