The fact of the matter is that native speakers use "be going to" and "present continuous" to refer to future actions, events and states much more often than "will". English learners usually overuse"will". This can be easily confirmed by a quick search in any English corpus.
With that out of the way, let's get to answering the question.
General uses of will vs. going to
The modal auxiliary verb will has a number of possible meanings. Four of the more common are:
A) certainty – John left an hour ago, so he will be home by now. (The speaker is certain that John is home)
B) habitual characteristic: Andrea will sit at her desk for hours without saying a word. (This is what she often does.)
C) volition (willingness): I’ll carry your bag for you. (The speaker is offering to carry the bag.)
D) instant decision: What will I do tomorrow? I know! I’ll go to the zoo. (The speaker decides to go to the zoo at the very moment of speaking – no plans had been made for this visit.)
now we are not concerned with (b),(c) and (d) here (I added them just for the sake of encompassing all the possible uses and clearing any confusion). let's take a look at (a); we use will when we are certain about something (could be now or in the future - the context will tell us which it is). Consider this example:
I don't think John will show up to the party.
the speaker is predicting that john won't come, he is not making this prediction based on some strong evidence, rather his prediction is perhaps based on past experience (he knows john) or common sense.
We could also use be going to make predictions; however, it should be based on present evidence. In the following example, the present evidence is the black clouds.
look at those clouds, I think it's going to rain.
We also use be going to to talk about future arrangements and plan which have been arranged or decided before the time of speaking. we use this form when the arrangement or plan is within our control.
I'm going to visit Vitally next month.
in the example above, I have decided to do this (this decision was within my control) and I made the decision before now (maybe a week ago, an hour ago or yesterday)
(on a side note: When we talk about future arrangements and plans, there is, practically speaking, no real difference in meaning between the present continuous and BE + going to. though present continuous is more common that be going to in that case)
Answer to the actual question
Will Tim play basketball on Sunday?
in this example, the speaker is apparently asking about Tim's intentions or plans for Sunday, so:
is Tim going to play basketball on Sunday
is Tim playing basketball on Sunday (this is more common)
sound more appropriate based on the explanations given above.
You could argue that the speaker is making a prediction, in that case using "will" is ok but it still sounds a bit off. More context is needed to make that call though.
Will you stay home today? No, I will go fishing.
in the second example, just like the first one, Speaker A is asking about B's future intentions, plans etc. and speaker B is talking about his plans so in both cases, "be going to is much more appropriate"
are you going to stay home? No, I'm gonna go fishing.
are you staying home? no, I'm going fishing (sounds a lot better!)