Hydrocarbons are gases because they mostly formed by carbon, a gas element, which mostly formed into gases due to the structural form of the element while others formed into liquids are formed when the elements/atoms of the structural formula are higher in its number and formed into liquids.
(Note: Actually, this answer is made for myself, but I already learned that lesson in previous days and that's all I remember from my teacher on this answer.)