Bayernburg (German for "Bavarian Castle"; Lithuanian: Bajenburgas) is the name of three separate wooden castles of the Teutonic Order in different locations along the Neman River in the Grand Duchy of Lithuania during the Lithuanian Crusade. Their exact locations are not known and historians provide conflicting versions. The first fortress was built in 1337 by guest crusaders, including Henry XIV, Duke of Bavaria, in whose honor it was named after Bavaria. Emperor Louis IV declared it the capital of the to-be-conquered Lithuania. The newly built castle withstood a 22-day siege by Grand Duke Gediminas, but was abandoned by the Order in 1344. The Teutons burned down the first Bayernburg and built a brand new fortress a little closer to Prussia. The second Bayernburg withstood a six-day Lithuanian attack in 1381 but was burned down in July 1384 by Vytautas when he betrayed the Order at the conclusion of the Lithuanian Civil War (1381–84). The third Bayernburg was built in spring 1387 where Georgenburg stood but the new name did not gain acceptance and the fortress continued to be known as Georgenburg. This fortress was captured and burned down by Vytautas in April 1403 during the first Samogitian uprising.
In spring 1337, many European knights, including Henry XIV, Duke of Bavaria, and nobles from Burgundy and Piedmont, arrived to Prussia for the crusade that was described by Wigand of Marburg. The Teutonic force sailed upstream the Neman River to an island near Veliuona. There they built two wards (identified as present-day Pilaitės) and another strong castle. This castle, named Bayernburg in Henry's honor, was manned by 40 brothers, 40 archers, and 100 soldiers. The contingent also included a number of Prussian natives, including Natangians and Sambians. Two of them decided to betray the fortress to Gediminas, Grand Duke of Lithuania. One of them stayed behind so he could secretly open the gates while the other reported to Gediminas that the fortress was built of logs and poorly reinforced with clay and should be an easy target. The conspiracy was discovered and the traitor was hanged.