This is a practical oversimplification which will be right most of the time. For more detailed information see Mastery of the Tenses!
"going to do"
For general future plans.
- I am going to the cinema next week.
- She is going to study Law.
For predictions based on observable data.
- It's going to rain! Look at those clouds!
- That room is going to look great when you finish!
For predictions based on things you know.
- This exam is going to be really difficult.
- They are going to be late if they leave now.
For questions when the other person probably knows the answer.
- What are you going to cook for dinner?
- When are you going to arrive?