There are many ways to convey the meaning of the idiomatic sentence just out of curiosity in Italian. I'd argue that we Italians do not use the same exact construction; we do indeed omit the just. But you shan't despair, for indeed our ways of expressing our curiosity are just as rich as those of any other language.
The shortest - and probably semantically most different from what you want - way of saying it is così, as in:
Ma dimmi, così!, cosa ne pensi della politica estera tedesca?
This is very informal and I would not use it too often, if not with close friends. Then we have the above mentioned per curiosità. As I said in the preamble we don't use the adverb just and yet per curiosità comes in many flavours:
- On its own. The semantics here is quite neutral
E gli ho chiesto, per curiosità, cosa ne pensasse.
- With toglimi or levami (which are basically synonyms; I say levami more often only because of my Tuscan ancestry). The per is dropped and the indefinite article (una) goes in front of curiosità. It literally means take this curiosity off me and semantically means quench my moderate thirst of knowledge
Ma levami una curiosità... dove sei stato ieri sera?
- With giusto. The giusto puts emphasis on the nonchalance of the question. It tells the askee that (s)he should interpret your question as casual in nature
Vorrei sapere che ne pensi di tutto questo, giusto per curiosità.
The first version is, as said, neutral and can be used in any context, formal and informal. 2. is informal and should almost be treated as così. 3. is still informal but not as informal as 2. and così.
We also have (tanto/giusto) per saperlo, but I don't think it coincides with our English idiom. It translates roughly as just for the sake of knowing it and does not convey curiosity - although some Italians may argue that I'm wrong!
I hope that you find my answer exhaustive enough and that I could help. I haven't dwelled into the densely populated realm of regional idioms (the realm of expressions such as toglimi lo sfizio), but I think that my reasons for not doing it are self-evident.
Edit: I read your question one more time and I suppose I should address what you are asking in the second paragraph a bit more. You are looking for a way to not sound rude. Well, it's not easy as a second (or third or whatever) language learner to develop the dexterity necessary to ask questions in a way that they sound natural to the ears of people whose mother tongue is the language you are learning, especially if these questions are about a topic as delicate as language. On your side you have the fact that Italians are a quite open people and are at ease with foreigners. It depends where you go, obviously. If you visit rural Sardinia do not expect to be able to improve your Italian: some of the older (70-80+) fellows do not even speak Italian! Nevertheless the people of the place where you are staying have usually seen foreigners at least once in their lives and thus know how to get along with them. So... let's thank tourism for that. Now to the practical part of the problem.
Imagine a banquet. Well, it's not a banquet, it's a sagra! You saw a locandina (poster) of the Sagra del raviolo di Casina and thought "It could be an anthropologically interesting event which might further my understanding of the Italian language and Italian culture altogether!" or just "I'd really fancy some ravioli right now". You go there. You find yourself sitting between two stout, middle-aged Italian men. They smile at you. You smile back. Their wives smile at you. You smile back. One of them strucks up a conversation with you by saying
Aaaah, agh voléva próp! Na béla raviuléda!
The acutes mark length, but it is of no importance. The man had assumed that you were from the area and he started talking to you in his dialect (Arzán, by the way, the dialect of Reggio Emilia). Baffled you stare at him and don't know what to say. Don't panic! You can answer by saying
Le chiedo scusa/Scusi, potrebbe ripetere? Non ho capito!
The man, hearing that you are not from the area, smiles again and tells you
Dicevo: Dopo una settimana di lavoro, ci voleva proprio una bella raviolata!
Let's assume that you don't know the expression ci voleva (proprio), which is Italian for I/We really needed it. You ask
Mi scusi di nuovo, ma cosa vuol dire ci voleva (proprio)?
The man, albeit maybe a bit discouraged since he just wanted to have some small talk and eat his ravioli, starts to make gestures and says
Ma come glielo spiego... vuol dire era necessario... oppure ce n'era bisogno!
In a situation like the one above don't hope to be able to rely on English. In other situations you might be lucky and get an explanation in English, but as I said: try to not rely too much on it.
If you have understood what the expression means, then good for you. If you haven't, then I would suggest to not push it too far: the discouragement might reach its limit. In that case write it down or something and look it up later in the night or the day after. But this is just common sense; few people like to be asked the same question many times, especially if they see that their answer is consistently being rejected as unsatisfactory.
To wrap things up: The expressions (Mi) scusi/Le chiedo scusa (I beg your pardon), Potrebbe ripetere, per favore? (Could you please repeat what you just said?) and Cosa significa/Cosa vuol dire? (What does it mean?) are all your friends. If you put (Mi) scusi/Le chiedo scusa in front of any question, then you are good to go. But don't worry if sometimes you come up as being rude: it's part of the language learning process.