What do the two bells of awakening in Dark Souls have to do with the story-line?

The ringing of the bells serves a couple of purposes. First, it causes the giant at Sen's Fortress to open the front gate, allowing the Chosen Undead to ascend Sen's Fortress in an attempt to reach Anor Londo. In addition, the ringing of the bells wakes the Primordial Serpent, Kingseeker Frampt, who was previously heard snoring at Firelink Shrine.

While that technically answers the question of what happens when you ring the bells, the "why" from the narrative may be a little more straightforward: because it is part of the legend that the Chosen Undead would escape the asylum, ring the Bells of Awakening, and reach Anor Londo.