One of the most basic of these elements is an ability to relate to the hero(ine). This can be as simple as the character you’re playing is funny and likable (an plumber in red overalls) or as complex as it becoming an extension of yourself (a silent scientist in a hazmat suit). You care about the character and what succeed along with them.
The second element is they have to do something and it has to matter enough to motivate your character, and you to keep playing. Hack up robots with a lasersword- yawn. Hack up robots with your lightsaber as you learn the ways of the Force and save the galaxy- now we’re talking! Action goes part of the way, but having to reason to act takes it further.
The third element in conflict or challenge; something or someone the hero has to overcome to achieve their goal. This often involves great risk to your character, up to and including ‘death’. Sometimes the obstacle is a benign as naughty green pigs trying to steal your eggs or as dangerous an evil AI that promises you cake while trying inventing new more deadly traps for you to overcome. Anything worth doing is work taking a risk for; thankfully in video games you get multiple chances. ;)
Unlike other mediums of storytelling video games have the ability to make you an active, not passive, part of the experience.
Just like this guy: