Mr Hancock was being briefed on Jack Williment's case, after the Yorkshire Evening Post yesterday revealed the four-year-old had been forced to sleep on a makeshift bed made from coats on in the hospital's A&E due to a lack of beds.
Mr Hancock met the hospital's chief executive, but was heckled by protesters as he left Leeds General Infirmary.
Mr Hancock could be seen speaking on the phone and hastily entering a car, as demonstrators shouted "shame on you" and "you are not welcome in this hospital, you are not welcome in this country".
One protester, who did not want to be named, said she wanted to ask Mr Hancock about the promise made by the Tories over new nurses.
She said: "I would have just said why are you lying to us about 50,000 new nurses? That is a lie. That 40 new hospitals, that is a lie. There is a child sleeping on the floor, stop telling us you have got any concern, any concern at all for the people in this country."
She added: "This is the result of 10 years of austerity. You have got a child asleep on the floor of a hospital."
It was suggested Labour activists had been shipped in in taxis to demonstrate at the hospital, however four people spoken to by The Yorkshire Post denied this was the case and said they worked nearby and had heard about Mr Hancock's visit on Twitter.
A Labour source said it was "utterly untrue the party organised anything of the sort".
The Health Secretary visited the hospital in West Yorkshire after Boris Johnson was shown an image of a four-year-old patient on top of a set of coats on the floor.
Mr Hancock has said he was "horrified" by the photograph of four-year-old Jack Williment on the floor of Leeds General Infirmary.
He told the BBC: "To tell you the truth, I was horrified.
"I have three small children myself. I have spent many evenings in A&E. I know what it feels like. I want to make it better."
Asked what he says to Jack's family, Mr Hancock said: "It's not good enough and I've apologised. I think the trust have handled it very well. The staff here have been brilliant.
"Jack's family have been at pains to point out that the staff have been absolutely superb."
Asked why he made the visit to the hospital on Monday when it was not on his schedule for the day, Mr Hancock said: "I've come because... I wanted to get reassurance from the trust that they're doing everything they can. I've been very impressed with the response of the trust."
Rumours circulated online that a Labour activist had punched one of Mr Hancock's team, but a video posted online instead showed him walking into the protester's arm.
A statement from West Yorkshire Police said: "We are aware of information circulating on social media in relation to an alleged incident involving election campaigners at Leeds General Infirmary this afternoon."
We are currently unaware of any reports to West Yorkshire Police of this nature but are seeking to verify.
He said: "One of the good things about what is happening here at the Leeds General is that they already identified the problems on this unit and the fact that there wasn't enough space, and they've got a plan, a funded plan. In fact they are trebling the size of the unit next year."
"So we are putting in a record amount of funding, the biggest ever injection into the NHS. That is needed, it is funded because we have got record numbers of people in work and are able to fund it, but I want to make sure the NHS is always there for everybody that needs it and that means constantly looking to see what improvements need to be made."
Mr Hancock said the number of children going to A&E at the LGI had risen dramatically.
He said: "So the task we have got is to make sure we rise to that challenge of increased demand for NHS services. Now one of the ways that they are doing that at the Leeds General is by increasing, in fact trebling, the size of this unit and then over the next five years we are going to completely rebuild this hospital. It's a £600m injection of of funds, in fact it is the biggest investment in healthcare in Leeds since the 1860s. So we are putting the investment in to make sure the NHS is always there."
He said: "Every A&E almost without exception is treating more people and doing more than ever before. The demand on our NHS is rising, not least because of our ageing population, also with an increase in the number of children attending A&E, and we have got to make sure that the funds go up to match that. We have got to have a sustainable source of that funding and we can only have that if you have a strong economy, that is why we are able to commit the biggest increase in NHS funds in its history. Then you have got to make sure that those funds get to the right place and I am really pleased that here at the Leeds General, even before this case came to light, they are rebuilding and expanding, trebling, the size of the unit that needed to be there to treat Jack."
On whether his appearance was out of panic during an election campaign he added: "No. I think what people want to see is the substance of increased investment in the NHS, making sure we are dealing with the problems in the NHS, and that is exactly what we are doing here at the Leeds General."