Natural convection in an enclosure is a classical problem in heat transfer field. In this study, natural convection induced by the heat source in the enclosure is studied with two analysis methods, i. e. CFD and artificial neural networks (ANN). The heat transfer in the enclosure is an unsteady process. During this process, the temperature fields in the enclosure are changing with time. The vertical temperature field of y = 0 at one moment is picked up for investigation. Firstly, FLUENT software which is a simulation program of CFD is adopted to simulate the temperature fields under different computation conditions. Then part of the simulation condition's temperature data is picked for training an ANN model and the rest of data is used for validating the ANN model. It has been found from the comparison between the CFD simulation and ANN prediction that the two results have a good agreement with each other. In the comparison, the max relative errors are around 12%, mean relative errors are around 0.3%, mean square errors are around 0.6%, values of absolute fraction of variance are all not less than 0.99. The results demonstrated that the ANN prediction have enough accuracy.