The fact that it can form hydrocarbons doesn't mean that's the only thing it can make.
There are so many carbon compounds due to a few factors:
- it has four valence electrons, thus it can donate OR accept up to four electrons, usually the maximum for all atoms (exclude the "unusual" conditions, like when you forcefully take away more than four from an atom that would normally accept electrons or something...);
- and following from above, carbon can form single, double, or triple bonds (as you can see in hydrocarbons);
- out of all atoms in Group 4 (those with 4 valence electrons) of the periodic table, carbon has the least atomic mass (with an electron configuration of 2,4) and thus form bonds more readily than say, Silicon;
- it is not particularly selective about which atoms it bond with.