Simulating convective heat transfer using traditional numerical methods requires explicit definition of thermal boundary conditions on all boundaries of the domain, which is almost impossible to fulfill in real applications. Here, we address this ill-posed problem using machine learning techniques by assuming that we have some extra measurements of the temperature at a few locations in the domain, not necessarily located on the boundaries with the unknown thermal boundary condition. In particular, we employ physics-informed neural networks (PINNs) to represent the velocity and temperature fields while simultaneously enforce the Navier-Stokes and energy equations at random points in the domain. In PINNs, all differential operators are computed using automatic differentiation, hence avoiding discretization in either space or time. The loss function is composed of multiple terms, including the mismatch in the velocity and temperature data, the boundary and initial conditions, as well as the residuals of the Navier-Stokes and energy equations. Here, we develop a data-driven strategy based on PINNs to infer the temperature field in the prototypical problem of convective heat transfer in flow past a cylinder. We assume that we have just a couple of temperature measurements on the cylinder surface and a couple more temperature measurements in the wake region, but the thermal boundary condition on the cylinder surface is totally unknown. Upon training the PINN, we can discover the unknown boundary condition while simultaneously infer the temperature field everywhere in the domain with less than 5% error in the Nusselt number prediction. In order to assess the performance of PINN, we carried out a high fidelity simulation of the same heat transfer problem (with known thermal boundary conditions) by using the high-order spectral/hp-element method (SEM), and quantitatively evaluated the accuracy of PINN’s prediction with respect to SEM. We also propose a method to adaptively select the location of sensors in order to minimize the number of required temperature measurements while increasing the accuracy of the inference in heat transfer.