There are a few possible explanations as to why we have candles on birthday cakes, nobody is completely sure how the tradition started. One possible reason is because the ancient Greeks used to take cakes (round to represent the full moon) to the temple of their goddess of the moon, Artemis. The Greeks are said to have placed candles on the cake to make it look as if it was glowing like the moon.
The custom of lighting candles originated with people believing that the gods lived in the sky and by lighting candles and torches they were sending a signal or prayer to the gods so they they could be answered. When you blow out the candles and make a wish this is another way of sending a signal and a message.
It has also been claimed that the Germans invented birthday cakes, and celebrated birthdays with a cake called "Geburtstagorten". The Germans were known to have been skilled candlemakers and may have put small candles on their cakes, possibly for religious reasons