Certain compounds are called hydrocarbons this is because they are composed with mainly Hydrogen and Carbon. Other elements are also present in these compounds like oxygen nitrogen etc but the main constitents are hygrogen and carbon so they are called Hydrocarbons.