'Am going to' is used for a plan or intention.
'Will' is used for a decision made at that moment.
Here's an example. Two friends are choosing ice creams:
A: What flavour are you going to have?
B: I'm going to have vanilla. That's what I always have.
A: That's so boring. Why don't you have something different. The blueberry one is amazing. I'm going to have that.
B: Mmm, OK. I'll have that too.