To is a preposition which begins a prepositional phrase or an infinitive.
Too is an adverb meaning “excessively” or “also.”
Two is a number. Many other words in English which reflect the number two are spelled with tw: twin, twice, between, tweezers, etc.
Examples: We went to a baseball game. (preposition)
We like to watch a good ball game. (infinitive)
We ate too much. (meaning “excessively”)
I like baseball, too. (meaning “also”)
Six divided by three is two. (number)
They own two Brittany spaniels. (number)