The infinitive includes the word "to" - to cook, to drive, to be.
I want to cook dinner now.
He knows how to drive.
"to" is also used as a preposition.
I go to the shopping mall.
Your rule that "to" is followed by a infinitive is not a good rule. Where did you learn this rule?