The situational irony in "The Gift of the Magi" arises from the fact that both Jim and Della sell their most prized possessions in order to buy the other a special Christmas gift, but the gift each buys is specifically designed for the prized possession each one sold. Della sells her hair so she can get the money to buy Jim a chain for his watch; Jim sells his watch so he can buy Della the special combs for her hair that she has been wanting for so long.
Jim is the first to recognize the irony. When he returns from work, he immediately notices that Della has cut her hair:
His eyes were fixed upon Della, and there was an expression in them that she could not read, and it terrified her. It was not anger, nor surprise, nor disapproval, nor horror, nor any of the sentiments that she had been prepared for. He simply stared at her fixedly with that peculiar expression on his face.
Della, at first, is worried that he doesn't like how she looks. She pleads with him:
"Jim, darling ... don't look at me that way. I had my hair cut off and sold because I couldn't have lived through Christmas without giving you a present.... I just had to do it. My hair grows awfully fast."
Of course, it's not her looks that Jim is concerned about. He tells Della:
"Don't make any mistake, Dell ... about me. I don't think there's anything in the way of a haircut or a shave or a shampoo that could make me like my girl any less. But if you'll unwrap that package you may see why you had me going a while at first."
When she opens the gift, she immediately sees why he was so taken aback,
For there lay The Combs--the set of combs, side and back, that Della had worshipped long in a Broadway window. Beautiful combs, pure tortoise shell, with jewelled rims--just the shade to wear in the beautiful vanished hair.
Della repeats, both for his and her own benefit, that her hair grows fast, and then turns her attention to the present she bought him. She hands him the watch, saying, "Isn't it a dandy, Jim? I hunted all over town to find it. You'll have to look at the time a hundred times a day now. Give me your watch. I want to see how it looks on it."
At this, Jim can only smile. Finally, he explains, "I sold the watch to get the money to buy your combs." The author does not reveal Della's reaction. The reader can assume she does what Jim asks her after this - put the chops on for dinner - and that the two eat their Christmas dinner knowing how much they are loved.
This, then, is what they learn. They learn they are loved so much that their partner is willing to sacrifice their most prized possession for them. The author brings this home in his final comments about the magi:
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.
He then calls Jim and Della "foolish children ... who most unwisely sacrificed for each other the greatest treasures of their house," but he soon says what he really believes:
... of all who give gifts these two were the wisest. Of all who give and receive gifts, such as they are wisest. Everywhere they are wisest. They are the magi.
They are wise for they know to value people over possessions, love over material wealth, and to demonstrate that love through generosity and personal sacrifice.