The billionaire made the remarks in footage released from a recent Bill and Melinda Gates Foundation event.
MSNBC show All in with Chris Hayes reported that Mr Gates was taking questions from his staff when he reflected on his meetings with the president.
Mr Gates told the audience he had never met Mr Trump until he was elected, adding that he had once “avoided him” when they were in the same place.
The philanthropist, who has a net worth of $90bn (£76bn), shared a story about the moment his daughter Jennifer first met the president at a horse show in Florida.
He said: “He went up and talked to Jen and was being super nice, and then, like 20 minutes later, he flew in in a helicopter to the same place.
“So clearly he had been driven away but he wanted to make a grand entrance in a helicopter.”
Mr Gates said he first met Mr Trump in New York in December 2016, and continued: “So anyway, when I first talked to him it was actually kind of scary how well he knew, how much he knew about my daughter’s appearance.”
He added that his wife Melinda “didn’t like that too well”.
Mr Gates said the second time he met Mr Trump was in March 2017.
He continued: “In both of those two meetings, he asked me if vaccines weren’t a bad thing because he was considering a commission to look into ill-effects of vaccines and somebody, I think it was Robert Kennedy Jr, was advising him that vaccines were causing bad things.
“And I said no, that’s a dead end, that would be a bad thing, don’t do that.
“Both times he wanted to know if there was a difference between HIV and HPV.
“I was able to explain that those are rarely confused with each other.”
HIV is a virus that damages the cells in the immune system and weakens a person’s ability to fight everyday infections, while HPV is the name for a group of viruses that affect the skin and most membranes lining the body.
Genital HPV infections are common and highly contagious.
Mr Trump appears to have ditched plans to investigate theories linking childhood immunisations and autism.
Vaccine sceptic Robert F. Kennedy Jr said health advocates had felt “enormous betrayal and disappointment” at the decision.
Democratic strategist Tara Dowdell told the MSNBC host: “We’re looking at a president that doesn’t know the difference between HIV and HPV but he has memorised Bill Gates’ daughter’s appearance.
More from Donald Trump
Trump questions whether Kim wants North Korea summit – but US still preparing
Donald Trump under-fire for calling certain illegal immigrants ‘animals’
Russia inquiry: Donald Trump Jr ‘couldn’t recall’ if he told President of 2016 meeting
N Korea: No interest in summit based on ‘one-sided’ demands
Trump turns his attention to jobs in China as ZTE struggles with ban
Seven Palestinians die as Israel celebrates US embassy move
“So if he spent more time actually learning policy, if he devoted just a quarter of the time that he devotes to harassing women and gawking at women to actual policy, memorising and learning policy, I think the country would be a lot better off.”
The Bill and Melinda Gates Foundation tackles issues around the world including reducing child mortality and improving education.