"Will" is used to express a possibility in the future:
For example: I'll buy some food.
You use "be going to" when you want to refer to a posibility in the near future
For example:I'm going to buy a new house this month (you can also say"I'm buying a new house this month" with the same meaning)
used for predictions, threats and warnings, promises, on the spot decision, after the verbs hope,think,believe,expect etc, expressions like I'm sure, I'm afraid and some adverbs like probably,perhaps, etc
be going to:
used for future plans and intentions, predictions based on what we see or know. Some of the time expressions are:
in a little while, tomorrow,the day after tomorrow, in 2/3/4 etc days' time,next week/month/year,tonight,soon,this evening,in the week/month/year, etc.