A process in which a methyl group is added to a cytosine base of DNA, which can change gene expression.