The medieval times in reality were a pretty awful time to be alive. Food sucked, everyone was poor and everything wanted to kill you in some way or other. When it comes to the world of video games, a medieval setting can make for an incredibly exciting setting for a game.
While there are a few games that attempt to emulate the realism of medieval times, the most popular games will fall under the fantasy side of things where it will be set in the same time period but have dragons and other kinds of mythical beasts.