can load into the game but can't play online

I try to play by myself on halo five but I can’t unless I have a friend with me.

what it says is that it is unable to connect to any matchmaking games and it says to check my internet but my internet can be able to play this game with no problem.

and another reason why it might be having this problem is that I got this game for free but nobody gave it to me.

A while back, an Xbox Live outage was causing a lot of headaches for many players. Problems are still ongoing to an extent, though that may be subjective.

At the time you posted there was an Xbox Live outage that has been affecting people over the weekend. It should be cleared up now but I would keep an eye on the Xbox Live status page just in case. There is also a large thread in the Halo 5 forums that any discussion / updates can be directed to.