Anomaly detection is an important problem in various fields of technology and industry, such as malicious intrusions into computer systems, finance and banking, health monitoring, etc. Currently, deep learning methods have achieved significant success in anomaly detection. Methods of detecting anomalies in a set of electrocardiograms containing normal ECG signals and ECG signals with various cardiovascular diseases have been investigated. To detect abnormal electrocardiograms, an autoencoder model in the form of a deep neural network with several fully connected layers was developed. Also, a method of selecting a threshold to separate abnormal ECG signals from normal ones was proposed, which consists in optimizing the ratio of performance indicators of the autoencoder model. A comparative computer analysis of the effectiveness of applying the proposed autoencoder model and other machine learning models, such as the support vector method, isolation forest, and random forest, to solve the problem of detecting abnormal ECG signals was carried out. For this purpose, metrics such as accuracy, recall, completeness, and f-score were used. The results showed that the proposed model surpassed other models with accuracy of 98.8%, precision of 95.75%, recall of 99.12%, f1-score of 98.75%.