This property is allotropy.
The physical properties are different because the carbon-carbon bonding in both the cases varies. In diamond, one carbon atom is bonded with four other carbon atoms with strong covalent bond so it is hard, while in case of graphite each carbon forms three strong bonds with other three carbon atoms to form sheet of hexagonal rings and one weak bond is formed between these rings which can slide over each other, so it is soft.
X is ethanol, (C2H5OH)
Y is ethanoic acid (CH3COOH)