While both are grammatical, the infinitive form (to keep cool) is more commonly used to indicate purpose, i.e., to answer the question "Why?" or "For what purpose?"
-- They wear light clothes. -- For what purpose do they wear light clothes? (Why do they wear light clothes?) -- To keep cool. They wear light clothes to keep cool.