Your close friend has probably had feelings for you for a while but never let you know about them.
He may be dating somebody else at the moment but that doesn’t necessarily mean that this is the person that he actually wants to be with.
Oftentimes in friendships, one party likes the other in a romantic sense but they never let the other know out of fear of how the friend will react.
In your case, he may have liked you for a while but was too worried or afraid to let you know. Hence, he started dating someone else because he felt that you probably didn’t like him romantically or that he just didn’t have much of a chance with you.