According to the paragraph:
The magi, as you know, were wise men--wonderfully wise men--who brought gifts to the Babe in the manger. They invented the art of giving Christmas presents. Being wise, their gifts were no doubt wise ones, possibly bearing the privilege of exchange in case of duplication. And here I have lamely related to you the uneventful chronicle of two foolish children in a flat who most unwisely sacrificed for each other the greatest treasures of their house. But in a last word to the wise of these days let it be said that of all who give gifts these two were the wisest. O all who give and receive gifts, such as they are wisest. Everywhere they are wisest. They are the magi.
The Magi, or three wisemen, are connected with being the first givers of gifts upon the birth of Jesus. Their gifts were "wise" because each symbolized something unique to the recipient. The Gold is the symbol of kings, Gapar gave him Incense, which is the an allusion to divinity, and Balthasar gave Mirrh, which in an allusion that the Son of Man will eventually have to die.
Regardless of this, in the story, the two protagonists likewise give each other utterly symbolic gifts that represent something unique to them.
In the end, however, O.Henry refers to them as silly- but this is just a way of showing the things one does for love, and the sacrifices one must endure for others. In doing this sacrifice, they became "the wise men"- or persons of equal quality of nature, above a world much less humbled by circumstances.