“I like to cook” is a very little bit clearer.
I like to swim. (Stating a preference)
I like swimming. (Could mean exactly the same thing, or it could mean that you like to follow the sport of swimming)
“I like cooking” isn’t as likely to be misinterpreted as many other verbs, but there is a slight chance.