These two phrases are easily confused, especially when they can sometimes be used interchangeably and yet at other times they cannot.
Let's look at a statement such as:
"I think the weather will be nice late."
"I think the weather is going to be nice later"
In these sentences both 'will' and 'going to' are correct.
Now, let's look at a statement such as:
"Look at those black clouds. It's going to rain."
We cannot say that it 'will' rain because it's not raining right now.
We use 'going to' because we think something will happen given the situation right now (we see the black clouds).
I will (I'll) is used when we decide to do something at the time of speaking:
Jenny: "Let's have a party."
Kate: "That's a great idea. We'll invite lots of people."
In this case Jenny made a suggestion and Kate reacted in the moment, so she used 'we'll' (we will).
Going to is used when we have already decided to do something.
Following on from the example above, let's look at how to use 'going to':
Kate meets Dan later in the day.
Kate: " Jenny and I have decided to have a party. We're going to invite lots of people".
Kate can use 'going to' because the decision to invite lots of people has already been made.
Let's look at some other examples:
Kate: "Where are you going? Are you going shopping?"
Dan: "Yes, I'm going to buy something for dinner".
In this case Dan uses 'going to' because he's already decided he needs buy something for dinner.
Dan: "What would you like to eat?"
Bob: "I'll have a sandwich."
In this case Bob uses 'I'll' (I will) because he is making the decision at the moment Dan asks him the question, he hadn't made the decision in advance.
Louise: "The ceiling in this room doesn't look very safe, does it?"
David: "No, it looks as if it's going to fall down."
In this case David uses 'going to' because based on the evidence he thinks something will happen, but it's not happening right now.
John: "I need somebody to take me to the airport tomorrow morning."
Ann: "That's no problem. I'll take you."
In this case Ann uses 'I'll' (I will) because she made that decision at the moment of speaking.