Who was Balin from The Lord of the Rings? Is he part of the company of Thorin Oakenshield in The Hobbit? If he was, then there is a person named Gloin in the company of Thorin Oakenshield whose son's name is Gimli, and he is part of the Fellowship of the Ring. But when he enters into Moria, he says "It is my cousin Balin's house, and it is called a mine". So I mean how would he be his cousin if his father Gloin seems like Balin's age when they were in the company of Thorin Oakenshield?
Yes, the Balin referred here is in fact the same Balin that was part of Thorin's company. And yes, in Moria, Gimli is referring to the same Balin, who was the Lord of Moria, by the time he was slain by goblins. So your question is how he could be a cousin of Gimli? To put it simply, Gimli was Balin's first cousin once removed.
LOTR wiki states this as follows.
Gimli stemmed from, but was not an inheritor of, the royal line. Through his father, Gimli was also the first cousin once removed (or "nephew", for simplicity's sake) of Balin, Lord of Moria, and his brother Dwalin, two more former companions of Bilbo.
If you are still not clear about how they are related, have a look at the family tree.
Ok, let's do this one by one:
Balin got a younger brother called Dwalin.
Both of them are cousins of Glóin.
Balin, Dwalin, Glóin and Óin teamed up with Thorin to reclaim the Lonely Mountain.
Here you got an overview of the family tree.
Concerning The Lord of the Rings: Balin has become Lord of Moria and you can see his tomb in the Chamber of Mazarbul.
Yes, Balin is part of Thorin's group in The Hobbit. So is Gloin, father of Gimli. And Gimli is a member of the Fellowship of the Ring. Please refer to this listing of the Thorin's company from Wikipedia.
Balin and Gloin are first cousins (and so should be of similar age). That makes Gimli Balin's first cousin once removed (a kind of first cousin that is closer than second cousin). Here is a listing of family trees in Tolkien's world. You will need to search for Gimli.
If you recall, Gimli rushes to the tomb of his cousin, only to read the inscription "Here lies Balin, son of Fundin, Lord of Moria".