To spend time doing something means you use the time available to you for something.
I spent a lot of time (at the station) seeing you. -- It means you were there and was seeing her in the meantime.
I spent a lot of time (at the station) to see you (=reason clause). -- The reason why I was there was to meet you when you arrived at the station.
Mind you, in not all circuimstances is it possible to use both the '-ing' and the 'to' version. They do not always make sense:
I spent time cleaning the house. -- makes sense: you were cleaning
I spent time to clean the house. -- does not make sense: the reason why you spent time was to clean the house.