Carbon forms large number of compounds because of tetravalency and catenation property.
Tetravalency – Carbon has valency 4, to attain noble gas configuration carbon share its valence electrons with other elements like hydrogen, chlorine, etc.
Catenation – Carbon also shows the property of self-linking in which it forms long, branched or cyclic chains to form large number of compounds.