He said he was going to Charm her. If you were not sure what that meant then it is on you to clarify.
Charm as in "sweet talk her", not "Charm" as in use a magical ability to control her mind to get her in bed, which by the way, I would crush readily under my +5 Iron-gauntlet-ed DM Fist of Absolute Power. Because that's rape and non-con is strictly forbidden at my table. The player will get a firm warning, the ONLY warning on the subject and if they object or repeat it they will be promptly pushed through the door and have it slammed behind them.
You did not say there was not a chance of success even though you knew that there was not a chance of success and that is exactly why it is a dick move.
I knew there was no chance of success for that NPC, okay. The players are NOT entitled to know what I know. They have no idea how the world will react to them unless they take some action within it. My job is to play out how the world reacts to player actions. Not to prevent my players from taking action by giving them metagame knowledge that their attempts will fail. Besides, it is a non-linear relationship. Your attempts to flirt with the unattainable girl may get the attention of some other suitors, or they may attract some girl who's interested in you and sees you get shot down as her chance to go after you. Doing a thing has more effects than just the thing you intended. Your roll may not matter in the context of where you wanted it to matter, but it may matter for other things. It is the player's job to FIGURE IT OUT, it is not my job to tell them.
I also want to emphasize this as it is one area where I strike back against player entitlement:
a nat 20 is not an "I win" button. It is merely the best possible outcome provided by a d20 roll. Rolling a nat 20 does not mean you automatically get what you want. It means you've made the best possible progress towards getting what you want. Especially in social conversations.
Because really NPCs do not have any free will which is why they are NPCs.
WRONG. NPCs are as free willed as PCs, that is as free-willed as any make-believe character run by a puppet-master outside their world can be. NPCs have no less free will than PCs, their will just tends to be generic because I don't have time to detail out their day-to-day activity. The fact that some of their reactions are pre-planned? That's not an indication of a lack of free will. Real people have pre-planned reactions to things. You know how you're going to react to certain issues, certain people, certain attitudes, certain comments, certain colors. You KNOW these things, so two weeks from now your reaction to spiders is the same as it was two weeks ago, provided nothing life-altering happens in between which is really the big difference between NPCs and PCs, not free will, but the fact that PCs are undergoing life-changing experiences EVERY DAY. NPCs are generally not.