Pausanias attributes the founding of Megara to Car, who was a king of Megara and built a castle called Caria, that had absolutely nothing to do with Caria.
Later on, Megara started colonies in Kalchedon and Byzantion. For most of the Peloponnesian War, Megara was on the side of Sparta and one of the causes of the war was the Megara Decree, which forbade merchants from Megara from trading in Athens.
One of the odder battles that occurred in Megara was an attack by Antigonos II Gonatas in 266 BCE. The matter seemed hopeless against his war elephants, but they managed to counter the huge animals with burning pigs. Supposedly the high pitched squealing caused tremendous discomfort to the elephants. The move was cute, but they lost the siege and had to capitulate to Antigonos.
This coin depicts Apollo on the obverse, which may be related to the Apollo oracles in Delphi and near Miletos that Megara headed.
Athens imposes trade sanctions on citizens of Megara, which angers the Spartans and is one of the causes of the Peloponnesian War.