There is a further use of "be going to": To talk events happening in the future as a consequence of the present state. "It is my birthday, so I'm going to be 30 tomorrow."
The pattern developed from a metaphor. We say "I'm going to London" to mean "there is a road which I will follow and at the end of the road is London". So when we use "going to" we get the idea of the future as being like places on a road.
So when we talk of prediction and intentions we mean "because I am on this 'road' I predict that this event will happen" or "because I choose to take this 'road' this event will happen".
If you say "I'm going to be 30 tomorrow", we are invoking this metaphor. "On the road of life, the place called "being 30" is tomorrow."
This metaphor is rich enough that nearly all future tense expressions can be expressed with "going to", or with "will". We tend to use "going to" with intentions or predictions, but we can use it for almost anything.