Right from the start, the earth has had periods of hundreds of millions of years when climates were tropically hot, alternating with periods lasting almost as long when climates were icy cold.
Around five to six million years ago, the climate changed from being hot all the time to alternating between cold and hot periods. Over the last two million years, there have been at least twenty ice ages, separated by warmer periods. This whole epoch is called the Pleistocene.