Background and Origin
Gimli is the son of Gloin, and is a descendant of Durin the deathless. His father accompanied Bilbo during his quest. Gimli was travelling with his father to Rivendell to speak to Elrond for advice, coincidentally at the same time the meeting in which the fellowship would be made, and so they went to the meeting.
Gimli joined the fellowship following the elf Legolas Greenleaf's application as he was unsure what the elf's motives were. He traveled with the fellowship along the Misty Mountains until finally he relented and told them of the mines of moria and the pass through there. In the mines he found the tomb of Balin, and also met his killer; the Balrog who claimed the life of Gandalf the Grey as well. After departing from the mines, Gimli became the first dwarf in decades to visit Lothlorien, the forest of dreams. He fought with Aragorn and Legolas atop amun hen in an attempt to but Frodo some time to escape.
Gimli accompanied Aragorn and Legolas in a pursuit to hunt down the Uruk-hai and rescue Merry and Pippin. As a result the 3 became known as the Hunters. Eventually they found Gandalf the White in Fangorn, and traveled to Edoras with him where they then went to Helm's Deep to repel the Uruk-Hai army of Saruman. Gimli bested Legolas here in a competition to see who got the most kills, by one uruk.
Return Of The King
Gimli then accompanied to the Rohirrim along with Aragorn and Legolas to Dunharrow, where the trio entered Dimholt and the path of the Dead to secure the allegiance of the army of the dead. After gaining allegiance, they defeated the Corsairs of Umbar and won the war for Gondor. Gimli also then accompanied Gandalf, Merry, Pippin, Legolas and Aragorn to The Black Gate in an attempt to distract Sauron from Frodo.
After the 3rd Age
Following the defeat of Sauron, Gimli attended the coronation of Aragorn, now King Elessar and also his marriage to Arwen. After this he departed with his good friend Legolas, where he showed the elf the wonders of the dwarven mines, and then was shown the beauty of the elven woods. After this he departed along with Legolas to the Undying Lands.