We investigate temperature-dependent evolutions of ferroelectric domain distributions in a strained BiFeO3 thin film by using an optical second harmonic generation (SHG) technique. At room temperature, the azimuth-dependent SHG intensity has two maximal lobes at 45 and 225 degrees which reflect the M-c crystallographic phase. As the temperature increases up to above 400 K, we observed clear signatures of the M-c-M-A phase transition; the SHG intensity exhibits an abrupt change, and the maximal SHG intensity appears at different azimuth angles being rotated by +90 or -90 degrees depending on the sample position. From the areal mapping of the SHG intensity with a diffraction-limited spatial resolution, we found that the domain distribution undergoes a large change across the phase transition in the first heating run, but afterwards, it remains almost the same upon the successive phase transitions in both cooling and heating runs. We discuss such random or deterministic selection of the polarization directions of ferroelectric domains in terms of Kittel's law and the free energy landscape in each phase. Published by AIP Publishing.