During 1917, London was attacked by German heavy bombers of the Gotha G.IV type, so keeping the name of the German city of Gotha in the name of the British royal dynasty became unsustainable.
On July 17, 1917, the British dynasty changed its German surname to Windsor. This happened by order of the then British King George V, published the same day in the official newspaper The London Gazette. Previously, the surname of the British royal dynasty was Saxe-Coburg and Gotha in English, which was a translation of the German name Sachsen-Coburg und Gotha. Namely, King George V came from a male line from the German prince Albert of Saxony-Coburg and Gotha, a member of the dynasty that ruled the eponymous sovereign state in the German province of Thuringia.
The aforementioned Prince Albert married the famous British Queen Victoria, and their common descendants have since borne his dynastic surname. King George V was the grandson of Queen Victoria and Prince Albert, and decided to change his surname due to anti-German sentiment in Britain during the First World War. Namely, during 1917, London was attacked by German heavy bombers of the Gotha G.IV type, so keeping the name of the German city of Gotha in the name of the British royal dynasty became unsustainable.
In his proclamation, George V gave the dynasty a new surname, Windsor, after the famous royal castle located west of London. The new name of the dynasty referred to all the descendants of Queen Victoria in the male line who were British subjects. Exceptions were, however, possible female descendants who came to foreign courts by marriage or could have married in the future. In addition to changing the name of the dynasty, George V. renounced in his own name, as well as in the name of all the mentioned members of the Windsor dynasty, all German titles, titles and honors. It was a hefty step, for the titles and honors mentioned were great, but their renunciation in such times of war was necessary for British self-confidence.