Cybersecurity is becoming increasingly important as the number of IoT devices andthe adoption of Building Management Systems (BMS) in modern buildings continues to grow. Monitoring smart buildings of the future is becoming increasingly critical and BMS depends on making accurate decisions based on sensor data. This thesis investigates anomaly detection in a district heating system with a focus on set temperature that is strongly infuenced by the outside temperature. We evaluate two machine learning methods Long Short-Term Memory (LSTM) neural networks and Isolation Forest using real world BMS data from a school building in Piteå, Sweden. Performance is measured in terms of recall, precision, F1 score and computational requirements. The LSTM models employs a sliding-window approach with varied window lengths and both single-layer and stacked architectures, while the Isolation Forests model varies in tree count and contamination levels. In real-world systems such as district heating, anomalies are rare by nature. To support model evaluation synthetic anomalies are often introduced using diferent methods. In this work, anomalies were injected based on localized statistical deviations. The stacked LSTM achieved the best balance between precision, recall and system resources. LSTM detected correctly 95 of 211 anomalies with an average deviation of 1.31°C. Resource results reveal that sliding-window size and LSTM depth substantially impact memory and inference latency, highlighting trade-ofs for real-time deployment. The fndings of this study could support the implementation of real-time anomaly detection in district heating systems, improving operational efciency and security, thus enabling building managers and operators to take timely actions.