I'm primarily referring to the swastika replacing the flag of the Weimar Republic.
It seems really odd to me that nationalists would want to change their country's iconography to something that is not only completely new but is also a foreign import. Would it have not made a lot more sense to restore the old flag of the Second Reich?
Since the 1500s various people had noted a similarity between Germanic languages and various languages spoken in India. This implied a common ancestor language and thus contact between distant groups of people thousands of years ago. The common ancestor language of Punjabi and modern German (and many other languages) was named Proto Indo-European.
At the time of the Nazis rise, the prevailing explanation for the existence of Proto Indo-European was that in antiquity a group of Germanic people called Aryans had invaded India and imparted on those people their language and culture. The swastika was thought to be a symbol used by the ancient Aryans.
The Nazis were trying to connect themselves to that hypothesized group of ancient and advanced Germanic people: their central position was that they were restoring a Germany for this Aryan race that had existed for thousands of years and that they were a steward of high culture and superior genetics.
The black, red and gold flag adopted by the Weimar Republic refers to the colours of the student societies (Burschenschaften) and other organisations which protested and rebelled in the mid-19th century. The Black-Red-Gold flag was first raised during the 1848 rebellion.
During the 1840s, there was widespread unrest across Europe due the failure of the potato crop*. This broke out in Germany in 1848 is a series of local uprisings and rebellions. A national assembley of sorts was formed in Frankfurt and free elections were held - contemporary images show the meeting hall of the assembley bedecked in the Black-Red-Gold colouring.
The assembly eventually folded due to internal disagreements amongst the governing parties, and a reluctance for the German monarchies in the various states to acquiesce to the assembly's demands.
In seeking to build a new republic following the abdication of the monarchy in the wake of the First World War, the Weimar Republic's rulers sought to appeal to an earlier tradition of German democracy, hence the adoption of the Black-Red-Gold colour scheme.
When the Nazis came to power, they held themselves against the Weimar culture, and against the principles of liberalism, pluralism and democracy, and hence they swiftly moved away from the colours orginating in the popular uprising of 1848. The Red-Black-White colours adopted by the Nazis reflect the colours of the Prussian and later German monarchies, which, given the belief in a necessary expansion to the East, suited the requirements of the Nazi regime, even though they themselves were not a monarchical regime.
*Although in popular memory this mostly focuses on the tragedy in Ireland, potatoes were (and still are, to some extent) a staple crop across much of Northern Europe.