Carbon has the ability to bond with other atoms of carbons forming large chains, branches, or rings. This property is called catenation.
Also, carbon has a valency of four and can combine with other elements such as hydrogen, oxygen, nitrogen, etc. Due to its small size, the bonds formed by carbons with other elements are very strong. Hence, carbon forms a wide variety of compounds.