I was told recently that the first variant is rude (mainly, because of the word 'wanted'). So I should use the second one. Is it true? Or are both the options okay? Thank you.
I guess you were told so, because the first one implies that the question will be asked, no matter what.
In the second case, one asks only if he/she may ask something. In this case, the decision whether to listen to the question or not is in in the hands of the person from whom it was asked. It makes the act of asking the question more polite and less invasive for the receiver.
Even so, the first one is pretty acceptable too. I would say it depends to whom it is said and in what context. In a formal conversation or when the receiver is a professor for ex. the second one is more suitable. For informal, the first one works.