According to this answer, The Legend of Zelda is cited as an early example of a video game with a storyline. It wove an actual narrative and quest into the experience, which was notable for its time.
While historians might debate which title truly came "first," Zelda is often celebrated for helping popularize story-driven adventure in gaming. It's a landmark worth remembering.