O.Henry chose this title for his short story because it points to the main sources of the irony that make the story what it is. The whole point of the story is the irony at the end and it is cops and an anthem that provide the irony.
Throughout the story, Soapy wants to get arrested but can not. This is a pretty funny situation. But the situation becomes really ironic right at the end of the story.
At the end, he stands outside the church listening to an anthem he remembers from his youth. He is inspired by the memory of better times and decides that he will reform his life. Right then a cop arrests him for vagrancy, just as he had previously wanted.
So, both cops and anthems frustrate Soapy's ambitions in ironic ways. This is why the story has this title.