It is difficult to explain, but I found this that might give you some insight.
To:
Expresses direction/ transfer towards, ex: She walked to the door; He gave some money to charity.
Expresses purpose (verb + to + verb), ex: We ran to catch the train
Shows a time period, ex: He works from 9 a.m. to 5 p.m.
Indicates a limit, ex: The cup was full to the top
For:
Expresses benefit of a person/ thing, ex: He opened the door for me
Expresses reason (because of), ex: He runs for his health
Shows the duration of time, ex: He works for 8 hours a day
Indicates a distance ex: He ran for 6 miles