It's a way of assuring the gift receiver that the gift didn't burden you, the gift giver. That makes everyone happy and allows the gift receiver to accept the gift without guilt. And no native speaker will think you meant, "your problem wasn't a problem after all."
If it's a major gift, then it might be more appropriate to say, "you're welcome." But for minor gifts (like telling the time or help with a coding problem) "you're welcome" is a tad smug.
In any case, you're right not to worry about it too much.
I tend to use "you're welcome" when it's things like getting called at 4am to come pick up a friend whose car broke down in the middle of nowhere. There's absolutely no way there their request didn't mess up my day, just due to the timing and time commitment involved, so it seems more appropriate to take their thanks seriously.
But on the whole, I think both are accepted well enough by native Americans in both situations, and it's one of the less important details of the language to worry about.
In the others, I use "no problem".
For example, I'm stranded at 3am and you give me a lift even though you were sleeping. If you say "No problem", since it's obviously a lie, I think that you might be mad or disappointed that I made such a request.
As for gifts giving - I think the top commenter meant "unwrapping gifts" upon receipt rather than "accepting" them or not accepting. Coming from xUSSR, we were also taught that it is more polite to downplay any gift received and leave unpacking for later, instead express utmost gratitude to the giver upon receipt, rather than to a quality/essence of the gift itself. It also makes it less embarassing for those who gave a very modest gift, but the recipient expresses equal gratitude to everyone (like on a birthday gift reception) not justifying it by a gift value.
PS: How China is similar to xUSSR! this must be socialist countries attitude of being more humble and downplay achievements.
I recently heard a nurse say, "It's my privilege" in response to a thank-you. This felt like a more heartfelt acknowledgement of the gratitude being expressed.
One might also experiment with "It's no burden", which seems to fall somewhere between "My pleasure" and "It's my privilege".
In comparison, "no problem" does not deny that I went out of my way but it is not a problem for me to do it (as long as you appreciate it).
Replying "you are welcome" feels like an acknowledgement that something I did to be a great deal, and to a Chinese (brought up in Chinese culture), this is embarrassing -- not I think it is embarrassing but I always automatically feel embarrassing. So each time even though I know I should reply "you are welcome", I always glitch out and when it come out, it is nearly always "no problem". Of course it means "no problem" for me (to do it or do it again), not that there wasn't problem for you that need help with. To a Chinese, attitude comes first and I have the first need of being modest (not as a virtue, but to actually feel comfortable). On the other hand, in Chinese culture, right or wrong is often not that important, so it is ridiculous that people would actually interpret "no problem" as a denial of their saying thank you in the first place (from the fellow comment, and this is actually the first time for me to understand why would some one give me over reaction when I reply no problem).
I actually always feel embarrassed (for another reason) when I realized I didn't say "you are welcome" and meeting some surprised expressions.
This article got me thinking and I decided that I should not feel embarrassed any more. There is nothing wrong in Chinese culture and I have been spent great effort coping with western culture half of my life and I believe most people do respect cultures. I will reply "no problem" and if people feel surprised I'll explain that is merely a culture difference.