Even though this story is mostly about Thor, it's Loki that gets it all rolling when his bird disguise fails, landing him squarely in Geirrod's clutches. What was Loki doing dressed up as a bird, anyway? Well, he's Loki. He likes to wear disguises, probably because he loves the idea of tricking people. Plus, he wanted to spy on Geirrod, probably because he enjoys knowing things he's not supposed to and being places he's not supposed to be. And besides, haven't you ever just wished you could be a bird?
But Loki's curiosity lands him in big trouble when Geirrod catches him. He's faced with a moral dilemma: Does he lure Thor into Geirrod's territory weaponless or remain locked in the box forever? Since Loki's not really loyal to anybody but himself, it's no surprise that he agrees to hand Thor over on a silver platter to save his own neck.
What is surprising is that he actually keeps his promise once he's back in Asgard. Why is anybody's guess, but here are a few of ours: (1) Oaths are really, really important in Germanic culture. Even Loki won't break one. (2) He's actually kind of scared of what Geirrod might do to him if he doesn't keep his promise.