Both sentences are examples of "reported speech" or "indirect speech." When you use reported speech, you usually "backshift" the verb. In the case of future "will," you backshift will to would. In the case of future "am/is going to," you backshift the verb to "was going to."
You do not always backshift the verb to the past tense, and in some cases backshifting the verb is optional.