Understanding wires inside junction box
You cannot use a GFCI here.  Fullstop.

It doesn't matter if you want to, nor if you think Code tells you that you must. (I don't think it does).  A GFCI is absolutely not allowed on the ceiling, because you would have no way to TEST or RESET it. Which means it wouldn't ever get tested.  Which defeats the purpose. 

Further, the wiring here is fairly complicated, and putting GFCI at an accessible location that would serve this location is a trick. You would have to resort either to a GFCI switch or breaker, depending on how your wiring is laid out.  (note below I talk about XXX and YYY and not caring which is which; with GFCI that would matter.)  It would also exclude the garage door opener, and those things pop GFCIs quite often, and that would send you into a vicious cycle of replacing GDO's until you find one that does not.  

As an installer:

Lamps take switched-hot and neutral. That's all you want. Do Not Mess with anything else, or you will have a nightmare on your hands. 

The whites are neutral.  They are using it both as service to the lamp and also a splicing block to carry neutral somewhere else.  Just keep them together and attach your lamp also, e.g. with a pigtail.  

The red wire is your switched-hot supply to the lamp.  And just so you know, red is the "conventional" color for switched-hot, where colors are possible.  If you're used to seeing black, it's because common /2 cables are made in black and white, but better electricians who color-code wires will tend to use red for switched-hot. 

As an electrician:

It's really common for wires to enter a box, and then continue onward to other locations. For instance, if you have multiple lamps, they all need switched-hot and neutral, so you might carry those onward to the other lamps.  Or if you have other always-hot circuits, you might care always-hot onward (which would have nothing to do with the lamp, obviously).  

The latter is exactly what happened here.  When the person originally wired it, they probably came from XXX to the switch to the lamp to YYY.   XXX and YYY are either supply, or onward always-hot power to other stuff, and it doesn't matter which is which (the wiring would work out the same either way). 


So they ran neutral all the way through; on white because that's required. 
They ran always-hot all the way through; on black because that's the convention.  
They ran switched-hot from the switch to the lamp, on red because they had a red wire available, and that was a good fit because that's the convention. 


I would encourage you to start thinking about using colored tape to mark wires by their function.  When you're able to think that way, instead of just blindly following recipes you find on Google, electrical gets a lot easier and you become able to do more stuff.

Here is how you mount a receptacle on a 4" octagon box.



By the way, don't trip about online prices.  In-store they'll cost about a dollar.  

You mount the receptacle to the plate using the center screw.  THEN, you attach the wires (including ground) to the receptacle, and button it up.  The slant is specifically designed to keep the recep from hitting the screw towers.