The outbreak of coronavirus disease 2019 (COVID-19) has seriously affected the environment, ecology, economy, society, and human health. With the global epidemic dynamics becoming more and more serious, the prediction and analysis of the confirmed cases and deaths of COVID-19 has become an important task. We develop an artificial neural network (ANN) for modeling of the confirmed cases and deaths of COVID-19. The confirmed cases and deaths data are collected from January 20 to November 11, 2020 by the World Health Organization (WHO). By introducing root mean square error (RMSE), correlation coefficient (R), and mean absolute error (MAE), statistical indicators of the prediction model are verified and evaluated. The size of training and test confirmed cases and death base employed in the model is optimized. The best simulating performance with RMSE, R, and MAE is realized using the 7 past days' cases as input variables in the training and test dataset. And the estimated R are 0.9948 and 0.9683, respectively. Compared with different algorithms, experimental simulation shows that trainbr algorithm has better performance than other algorithms in reproducing the amount of the confirmed cases and deaths. This study shows that the ANN model is suitable for predicting the confirmed cases and deaths of COVID-19 in the future. Using the ANN model, we also predict the confirmed cases and deaths of COVID-19 from June 5, 2020 to November 11, 2020. During the predicting period, the R, RMSE, and MAE for new infected confirmed cases of COVID-19 are 0.9848, 17,554, and 12,229, respectively; the R, RMSE, and MAE for new confirmed deaths of COVID-19 are 0.8593, 631.8, and 463.7, respectively. The predicted confirmed cases and deaths of COVID-19 are very close to the actual confirmed cases and deaths. The results show that continuous and strict control measures should be taken to prevent the further spread of the epidemic.