According to Erik von Kuehnelt-Leddihn's book "Leftism Revisted", the Nazis and the German Communists originated from the same splinter groups of German Socialists.
He asserts in his book that the Nazi Flag, (Red Background/White Center with a Swastika) Were originally made from Communist "Hammer and Sickle" flags over which a Swastika was placed to cover up the Hammer and Sickle. That is why the Nazi flags were Red. The original Communist flags from which they were made were Red.
In fact, Stalin was relieved that the Nazis gained power over the Communists in Germany, because he felt that a Communist Germany would ultimately have rivaled the Soviet Union for leadership of the Communist movement. His agents basically turned over most of the German Communists over to the Gestapo.