I see what you are saying, but how far are you in the book? See, in the book, I feel Legolas and Gimli are on about the same level as members of the fellowship (the hobbits are the heros, for Tolkien, Merry and Pippin have much bigger roles to come than what they got in TT while Aragorn is THE KING and greatest man on earth, while Gandalf is, well, Gandalf). That is why I think they end up such good friends, as they are the two supporting members in a way. Now, in the movies, Legolas is made uber-cool, as everyone has been noting, while Gimli is made into comic relief. That's a bit unfair, I think. Legolas has a wide range of skills, because he's an elf, that he can use more often than Gimli can apply his dwarf skills (the fellowship never needs to forge weapons, armor or construct anything out of stone, wheras far-seeing eyes are always usefull in the open plains of Rohan). I know that Moria may be seen as "his turf" but he had never been there, and in fact dwarves hadn't been back there in hundreds of years, apart from Balin's expedition which they didn't have much contact with (didn't even know they were all dead!). I thought that, though I don't remember exactly, in the books he takes a more active role leading them through the caves, while Aragorn and Legolas are mostly silent. Gandalf is, of course, in charge, because he's been through before.
We mustn't overlook, however, his value to the fellowship as a plain and simple warrior. He's probably the second best fighter in there, at close range. Aragorn is, of course, matchless, but Legolas, in the books, is very arrow-dependent, and not quite the knife-wielding badass of the films. You'll see when you get to the competition part--it is in the books! Also, he saves Eomer's life at Helm's deep (not a big spoiler--though in the movies, Eomer isn't even at the battle...

). And, looking just at the films, Gimli does save Aragorn in the battle at the end of Fellowship (as does Legolas, I think). In the two towers film, even his fighting has to be comic, though, as he gets trapped under two wargs in the first battle...
Anyway, I think the point raised about Gimli as helping dwarf-elf relations is a good one. Basically, though, I feel that he and Legolas are there to do the fighting and support Aragorn and the hobbits in their quest, which they do admirably, and the quest couldn't have been completed without two such fighters. Does Legolas not deserve the "why is he there" question simply because he can see or miles, shoot a bow and help Aragorn with the tracking a little? If so, then Gimli is there because he can wield an axe and protect and serve his companions and represent the dwarves in the quest to save the world.