When you see a flame, you are seeing something that is glowing with a certain color. Heat naturally causes things to glow. If you heat up a piece of iron hot enough, it will glow red. Heat it more and it glows orange or yellow. The temperature controls the color.
In the yellow part of a candle flame, you are seeing tiny particles of soot that are hot enough to glow yellow.
In a blue flame, two things are happening. First, the flame is very hot. Second, it is gas molecules that are glowing rather than pieces of soot. Very hot gas molecules glow blue.