The Union Flag's red, white and blue colours come from the crosses associated with England, Scotland and Ireland and the historical development of the United Kingdom.
England's red cross
England's national flag is the red St George's Cross on white. It became one of the elements used in the Union Flag.
Scotland's white saltire
Scotland's flag is the blue field with a white diagonal cross known as the Saltire or St Andrew's Cross.
The first Union Flag
In 1606, following the union of the crowns of England and Scotland, their crosses were combined into the first Union Flag.
Ireland's red saltire
The later design incorporated the red saltire associated with St Patrick and Ireland. This produced the familiar combination of red, white and blue.
Why Wales is not separately represented
Wales is a constituent country of the United Kingdom, but the Union Flag was created before the modern union arrangements that produced the present UK and before Wales would have been represented as a separate element in the design.