Because this is an emphatic sentence, the important thing her is "Glas" (blue). Mae is only used at the beginning of a positive statement. "ydy" or "yw" are used in emphatic sentences and questions.
This sentence would make sense in a conversation where someone said "Owen's flag is blue" and someone replied "No. Blue is the colour of Megan's flag."
It's the same construction used by Abbott & Costello in the "Who's on first? What's the name of the man on second base?" sketch. The joke wouldn't work without this construction. Mwynheuwch!! https://www.youtube.com/watch?v=kTcRRaXV-fg
The literal translation of this is 'blue is color of flag of Megan', there are different ways of transposing that to English, the shortest one is the one quoted, another would be '(The) color of Megan's flag is blue'. You don't need the definite article in the Welsh sentence but it makes more sense to add it to the English one.
My question is essentially the same as that from PampeliusS - so far everything that has been taught about "is" as a positive statement has been using "mae" in the third person, e.g. "Mae Megan yn canu" etc. We have been told that "ydy" is used when asking a question in the third person, e.g. "Ydy hi'n gweithio?". So how come ydy suddenly appears in this expression to mean "is"? Does that mean I could have been saying all along "Megan ydy x", rather than "Mae Megan x" to mean "Megan is something or other"? Why isn't it "Mae baner Megan yn lliw glas"?