Limestone is a general name for a vide variety of sedimentary rocks which are composed primarily of calcium carbonate.
Calcium carbonate comes from many sources, most of which have a biological origin.
Things like bones and teeth and shells are generally made of this amazing stuff, and when the critter dies, the calcium carbonate is returned to the earth for recycling into new and wondrous forms. There are quite a few different types of these primitive life forms. Many live in the ocean, and some extract calcium carbonate from the seawater to make a protective shell. One cell may not seems like much, but hey, it's all they got and worth taking care of. Either way, the discarded shell settles to the seafloor, where untold bazillions of them pile up.