The first mention of the town dates back to 1342. On the edge of a forest, near a Prussian settlement called Rast, the Teutonic Knights built a wooden watchtower called Rastenburg. It was probably located on a small hill near the Guber River, where the castle still stands today. The watchtower was built to defend the Teutonic state from Lithuanian raids and was also a staging point for Teutonic expeditions to Lithuania. The watchtower was twice captured and burned by the Lithuanians, in 1345 and 1347, but was rebuilt each time. The settlement near the watchtower grew, and on November 11, 1357, the Teutonic Order granted it town rights. At that time, construction began on the brick castle that stands to this day.
The construction of the castle was completed before 1374, when it was first mentioned in a list of Teutonic Order castles. The first known description of the castle dates back to the early 18th century (around 1706). It was written by Adam Huldreich Schaffer, the rector of the local school and the author of the „Chronik von Rastenburg”. For the earlier period, we only have information from castle inventories about the rooms in the castle and brief mentions of construction work.
The castle was originally a three-winged building, enclosed on the west side by a wall with a gate.
The north wing of the castle was the most impressive. It was the residence of the pfleger, the local administrator of the Teutonic Order. There was also a chapel in the wing, which was still in use in 1628. The castle was surrounded by a defensive wall on three sides, with cylindrical towers added in the early 16th century. A wall was also built in front of the entrance to the castle from the city side.
The castle and the adjacent part of the town called New Town housed, among others, a bakery, kitchen, mill, malthouse and brewery, a meat and grain store, a pantry, an armory and a powder magazine, as well as a prison, mentioned in 1564. After 1525, the castle became the seat of the ducal starosty. Further construction work on the castle was carried out in 1528-1529 and 1559-1560. The western wing of the castle was rebuilt before 1566, and a cylindrical tower with a staircase was built in the north-west corner of the courtyard in 1622. In 1682, two upper floors of the northern wing were demolished, leveling its height with the remaining wings of the building. It is possible that part of the cellars under the eastern and southern wings were also filled in at that time. The trace of the former entrance to the cellars in the southern wing is still visible today in the wall in the south-eastern corner of the castle courtyard.
The castle was rebuilt in the 18th and 19th centuries to accommodate residential functions. New, much wider windows replaced the Gothic windows. On December 15, 1797, a major fire broke out in the castle. In 1911-1912, after the city purchased the property, the castle was rebuilt again, with most of the rooms being converted into apartments. The office of the 3rd Infantry Brigade was also located there at the time. Minor conservation work was carried out on the castle in the late 1930s.
Before World War II, the castle was home to a financial office and apartments for officials. In the early 1940s, the western part of the basements under the northern wing was converted into an air-raid shelter. In late January 1945, after the city was captured by Soviet troops, the castle and most of the old town were burned down. The plan for the reconstruction of the castle, combined with its regothisation, was based on a drawing reconstruction made in the late 19th century by Steinbrecht.
After the reconstruction that took place in the years 1962-1967, the building regained its Gothic character by raising the roofs of the southern and eastern wings and adding one floor with Gothic gables and a sloping roof to the northern wing. Currently, the Kętrzyn Castle houses the Wojciech Kętrzyński Museum and the Municipal Public Library.