This is a good question. The idea of the magi comes out at the end of the story. O. Henry calls Della and Jim wise, like the magi from the story of Jesus' birth.
In light of this, we need to know the context of the gospel story. In Matthew 2:1-12, we read about the magi. These are wise men that come from the east following a star to pay homage to the baby Jesus. They come from a far distance and they give gifts of gold, frankincense and myrrh and they leave. We hear nothing more about these magi.
O. Henry calls Della and Jim wise like the magi, because they give each other costly gifts. In the story, Della cuts her hair and sells it to buy Jim a chain for his watch and Jim sells his watch to buy Della combs for her hair. In the end, it does not matter that they both have gifts they cannot use, because the wisdom here is not in receiving gifts, but in the giving of them. This is why they are wise.
The title "Gift Of the Magi" is a symbolism. When Christ was born, the three wise men brought gifts which they would bring to a king, befitting the honor and glory of a king. When Jim and Della find buy the gifts for each other, they buy the best they know the other person would love to have.