The identification of anomalies holds significant importance across various domains, including finance, healthcare, and cybersecurity. Recently, deep learning techniques, such as autoencoders and variational autoencoders (VAEs), have emerged as promising approaches for anomaly detection. In this particular investigation, we employed a VAE to detect abnormalities in chest X-ray images and differentiate them from normal images. To train the VAE, a custom loss function was employed, combining reconstruction loss and KL divergence loss, using a dataset consisting solely of normal images. Anomalies were identified based on the presence of a high reconstruction error. The outcomes demonstrate that the VAE algorithm exhibits the capability to identify abnormal patterns and separate them into distinct distributions for normal and anomalous data.