I know I'm not the first one to attempt an answer, but here's my two cents:
A game loop can be considered the "heartbeat" of a game. It repeats the game code which handles the attributes and interactions between the objects in the game. Each repetition is often called a "tick," and on every tick, the game performs one round of calculations.
For example, let's say you have a game where the player is controlled by the WASD keys. The code might look something like this (I've used "pseudocode" reminiscent of Java, but the concept applies to any language or engine):
public static void main(String[] args){
boolean runGame = true;
while(runGame){
if(Controls.wKeyDown) player.yPosition++; //If W is down, move the player up by one unit
else if(Controls.sKeyDown) player.yPosition--; //If S is down, move the player down by one unit
if(Controls.dKeyDown) player.xPosition++; //If D is down, move the player right by one unit
else if(Controls.aKeyDown) player.xPosition--; //If A is down, move the player left by one unit
calculateInteractions(); //This method might handle interactions between the player and other parts of the world
wait(20); //pause for 20 milliseconds so the game isn't unplayably fast
}
}
This is a highly simplified version, but it gets the point across. What happens is, every tick, the game checks whether or not the W, A, S, or D keys are held down. If one of them is, it moves them in the correct direction. Then, it pauses for a bit and the loop goes back to the top. If the same key is still held down, it will move them another unit in the right direction.
Game loops often loop through every object in the game world to check for interactions with every other object. For example, the calculateInteractions() method mentioned above might be something like this:
private void calculateInteractions(){
for(gameObject obj1 : worldObjects){ //Loop through everything in the world
for(gameObject obj2 : worldObjects){ //Loop through everything again
if(objectsCanInteract(obj1, obj2)) //Can the two objects interact? (Are they close enough? Are they the right kind of objects? Are they not the same object?)
obj1.doInteraction(obj2);
// If the two objects can interact with each other,
// have the first object perform its interactions with the second.
// When it's the second object's turn to be obj1, it can perform its actions on the original first object
}
}
}
Again, this is heavily simplified. Hopefully it gives a general idea of what a game loop is and does.