In the beginning of Avengers (2012) Loki has a sceptre which contains the mind stone.
In the end of the previous film (Thor), Loki fakes his death. He doesn't have it till that point.
- Who gives him the Sceptre?
- Why would anyone give up the Mind stone?
EDIT
I'm not sure what makes the answer so obvious here.
The person who hands the sceptre wants the terreract, which means the person is after the space stone.
The same person gives Loki the Mind stone to get the job done.
Only Thanos could make a play like that, but we aren't shown Thanos giving this job to Loki here.