Dominic Cummings said No 10 was assured all patients sent from hospital to care homes would be tested first, but later found out they were not.
The health secretary said he did commit to that, but said testing capacity had to be built up before it was possible.
Boris Johnson has also rejected Mr Cummings' claims that policy mistakes led to thousands of extra Covid deaths.
The PM said some of the "commentary" did not "bear any relation to reality".
Mr Johnson and Mr Hancock's comments come after a marathon seven-hour evidence session from Mr Cummings before MPs, during which he made a series of explosive claims about the government's handling of the pandemic.
Labour has urged the government to bring forward the public inquiry into the Covid pandemic - due to start next year - but this idea has been rejected.
In total, 127,758 people have died in the UK within 28 days of a positive test for the disease, according to official figures.
More than 42,000 of those deaths have happened in care homes in England and Wales, according to the Office for National Statistics.
At an appearance before MPs on Wednesday, Mr Cummings claimed Mr Hancock had assured him and the prime minister early in the pandemic that people "were going to be tested before they went back to care homes [from hospitals]".
"We only subsequently found out that that hadn't happened," said Mr Cummings, adding that later government claims about putting a shield around care homes were "complete nonsense".
At a Downing Street press conference on Thursday afternoon, Mr Hancock said "of course" he had committed to testing everyone returning to a care home from hospitals, but that it "took time" to build the testing capacity.
"My recollection of events is that I committed to delivering that testing for people going from hospital into care homes when we could do it," he said.
"I then went away and built the testing capacity… and then delivered on the commitment that I made."
Dr Jenny Harries - head of the UK Health Security Agency - was also at the press conference. She added that the virus entered care homes in different ways and that hospital discharges were "definitely not the majority route of entry".
She said care home cases also came from community transmission - for example from workers "going in and out to provide care".
Mr Cummings also attacked the health secretary's integrity, saying he "should have been fired for at least 15 to 20 things, including lying to everybody on multiple occasions in meeting after meeting in the Cabinet Room and publicly".
And he told the MPs Mr Johnson - for whom he worked until he was ousted in a Downing Street power struggle last autumn - was "unfit for the job" of leading the country.
He added that he had repeatedly urged Mr Johnson to sack Mr Hancock, calling the health secretary "completely incapable of doing the job".
Speaking in the Commons before the press conference, Mr Hancock hit back, saying he wanted to "put formally on the record that these unsubstantiated allegations around honesty are not true,"
He added: "I've been straight with people in public and in private throughout."
In an apparent barb aimed at Mr Cummings, who left Downing Street at the end of 2020, Mr Hancock said the "operation and function" of government had become "easier" over the past six months.
And in response to a press question on whether he had Mr Johnson's confidence, Mr Hancock said: "The prime minister and I talk all the time."
He added that they are focused on getting the country out of the pandemic.
On a visit to a hospital in Colchester, Essex, the prime minister, when asked if tens of thousands of people had died needlessly, replied: "No, no I don't think so.
"Of course, this has been an incredibly difficult series of decisions, none of which we've taken lightly."
He added that "at every stage we've been governed by a determination to protect life, to save life, to ensure NHS is not overwhelmed".
But, on a visit to Avonmouth, Labour leader Sir Keir Starmer said that the "buck stops" with the prime minister over the government's performance on Covid.
He added: "Dominic Cummings can't be the last word on this. We need to get all the available evidence.
"I don't think the prime minister has made good decisions in this pandemic."
During Wednesday's session with the Health and Science select committees, Mr Cummings also said:
* The prime minister said he would rather see "bodies pile high" than take the country into a third lockdown - the PM has denied making this comment
* A herd immunity strategy, where the virus is allowed to spread so people develop immunity, was dropped when the likely death toll became clear
* His trip to County Durham during the first lockdown had "undermined public confidence"
* The PM had offered to be injected "live on TV with the virus" to show the public there was nothing to fear
* The running of the government "kind of collapsed" when Mr Johnson was hospitalised with Covid
* The PM's fiancee Carrie Symonds "wanted to get rid of" him
Downing Street said "all sides" of the story would be heard at the upcoming public inquiry into the pandemic, adding that the prime minister would be "getting on with the job" on Thursday by visiting a hospital.