Catalysis of the reaction: S-adenosyl-L-methionine + histone H3 L-lysine (position 9) = S-adenosyl-L-homocysteine + histone H3 N6-methyl-L-lysine (position 9). This reaction is the addition of up to three methyl groups to the lysine residue at position 9 of the histone H3 protein.