Accurate detection of the QRS complex is crucial for interpreting electrocardiogram (ECG) signals as it serves as a critical reference point for locating the heartbeat. However, current QRS complex detection methods for ECG signals collected by wearable ECG devices are still inadequate due to complex noise interference. In this study, we propose a novel QRS complex detection method based on dynamic Bayesian network (DBN), which integrates the probability distribution of RR intervals reflecting the time interval variation between adjacent beats. Unlike previous detection methods that solely focus on ECG waveforms, this study explicitly integrates both the information of ECG waveform and heart rhythm into a unified probability model to detect QRS complex positions, significantly improving the algorithm’s robustness to noise. Additionally, the proposed method uses an unsupervised parameter optimization approach based on expectation maximization (EM) to adapt to individual differences of patients. Furthermore, several simplification strategies are introduced to improve the reasoning efficiency, and an online detection mode is designed for the real-time applications. The detection outcomes demonstrate that the proposed method outperforms other state-of-the-art QRS detection methods, including deep learning (DL) methods, on datasets with strong noise interference. In conclusion, based on DBN, the proposed QRS detection algorithm demonstrates outstanding accuracy, noise robustness, generalization ability, real-time capability, and strong scalability, indicating its potential application in wearable ECG devices.