Using the past tense is a way of offering flexibility in an invitation or request.
You don't need to feel compelled to accept because it is being phrased as a passing thought.
A whim.
english.stackexchange.com/users/460/Chris Noe
The difference between I wonder if you'd like to come for dinner and
I was wondering if you'd like to come for dinner
is that the second sounds more hesitant.
It's used to make the invitation less direct and thus more polite.
"I wonder if you'd like to come for dinner" sounds like something your boss would say, it's almost like an order to come to dinner.
There's nothing wrong with the grammar in the second form; if you are wondering now then you must have been wondering for at least a small period of time beforehand.
english.stackexchange.com/users/None/
I was wondering, and now I am asking.
english.stackexchange.com/users/914/Picturepocket
"I was wondering" gives the other more freedom to accept or refuse because it has the feeling that I will not get embarrassed if you refuse my invitation because I was and not I am !
That was in the past!
english.stackexchange.com/users/873/Dia
Why isn't the present tense used?
I am wondering if you would like to come for dinner. =========================
The only word indicating tense in your example is 'am'.
But in this situation, it's really only a present tense FORM.
This FORM is used to be more direct, in this case, it could [note 'could' is a future] be taken as rather abrupt.
Past tense FORMS, "I was
wondering" are used in English to be more indirect and therefore more polite, softer, less challenging.
Compare " Do
you want something to eat?"
versus " Did you want something to eat?" Tense FORMs as opposed to the actual use of tense to mark time are simply different grammatical/pragmatic animals.
english.stackexchange.com/users/2015/Dan
Why isn't the present tense used? I am wondering if you would like to come for dinner.
Why is the past tense used in "I was wondering if you would like to come for dinner?"
english.stackexchange.com
<verbs><tenses><past-tense><present-tense>
english.stackexchange.com/questions/2132
english.stackexchange.com/users/786/ablmf
Using the past tense "I was wondering" is a way of offering flexibility in an invitation or request. It makes the invitation less direct and more polite. It's a polite way of asking which offers greater flexibility.
Using the past tense "I was wondering" is a way of offering flexibility in an invitation or request. It makes the invitation less direct and more polite. Using the past tense is a way of offering flexibility in an invitation or request. "I was wondering" gives the other more freedom to accept or refuse. It's used to make the invitation less direct and thus more polite. "I wonder if you'd like to come for dinner" sounds like something your boss would say, it's almost like an order to come to dinner.   
Using the past tense is a way of offering flexibility in an invitation or request.  It's used to make the invitation less direct and thus more polite. However there's nothing wrong with the grammar in the second form. Although there is nothing wrong with using the present tense in this case, the past tense is often used to be more polite.
It's a way of offering greater flexibility and avoiding a sense of obligation. It's a way of being more polite. It leaves the recipient more freedom to refuse.
Using the past tense is a way of offering flexibility in an invitation or request. "I was wondering" gives the other more freedom to accept or refuse. It's used to make the invitation less direct and thus more polite. "I wonder if you'd like to come for dinner" sounds like something your boss would say, it's almost like an order to come to dinner.   
Using the past tense is used to make the sentence more polite. There is nothing wrong with using the present tense in this example.