We use the preposition “to” to introduce verbs when we talk about the verbs themselves — that is, infinitives. Hence, the clever nickname, “infinitival ‘to.’” Some say that, indeed, it’s part of the verb. That’s why putting anything in between them constitutes a split infinitive — the “boldly” in the middle of “to boldly go.” Others say this is bunk: the “to” introduces the verb but is not part of it.
“Some words do not fit well into any of the classes,” writes the “Oxford English Grammar.” “Among them?.?.?.?the infinitive particles ‘to,’ ‘so as to’ and ‘in order to.’”
So yes, “to” is a preposition most of the time. But when hooking up to make an infinitive, it becomes something else.