Two-dimensional thermal convection in a fluid layer confined between two-infinite horizontal rigid walls kept at spatially periodic temperatures is investigated by direct numerical simulations. The two walls have the same mean temperature, or the lower wall has the higher value than the upper one. Computations are made mainly for air. When the Rayleigh number is small, the steady convection which preserves several kinds of spatial symmetries occurs. For some parameters, multiple steady solutions are found at higher Rayleigh number than a certain critical value, when the system constitutes a thermally unstable configuration. With increasing the Rayleigh number, convection evolves from a steady state to a temporally chaotic flow. It is observed that the transition to the chaos occurs via quasi-periodic states with two or three basic frequencies or via sequences of period-doubling bifurcations, according to the boundary temperature distributions. For a certain configuration, a reverse transition from a time-periodic flow to a steady-state flow occurs, and periodic windows are observed within chaotic regions. Temporally chaotic flows which preserve a certain spatial symmetry of the flow field are observed.