Crikey, a tricky one. What was he like as your boyfriend? Was he a decent bloke, or manipulative/violent/other issue? Do you think he has alcohol issues?
It's good you got him food. You might give him money for a hostel or a local YMCA hostel for tonight/tomorrow. Did he have a sleeping bag or anything?
I know from a recent experience (not me, homeless person I helped) that it only takes a few weeks to go from looking like everyone else, to having that 'homeless' slightly unkempt look, frayed collar, a bit of grime etc.
He really needs expert support. Can you refer him to a local homeless charity? Some ask you to report the location and they send out support workers and try to sort out the wider issues (benefits, accommodation). Then you could keep a kindly eye on him, provide a listening ear, take him for lunch sometimes, use your connections to find him some work, treat him as a friend, not a 'homeless person'.
Are you wondering if you should have taken him home? If it was a current friend I would, but someone I hadn't seen in years and had no idea what had happened since, I wouldn't, for my own/DC's safety. Tonight I would look him up on social media, ask around a bit, see if anyone knows more to the story.
Tomorrow, possibly knowing a bit more, and after consulting local homeless charity, I'd go back, take him to a cafe for lunch, with a notepad and pen and talk to him. You won't be able to fix everything for him yourself.
I took a homeless guy home for dinner a few times (same bloke). DH was there and we didn't leave him unattended (except in the shower!), we took various precautions. Offered him the use of our shower, offered some older clothes of DH for interviews etc, gave him a decent meal with lots of vegetables as well as meat, sent him off with extras in a tupperware. Helped with his job search, interview practice and CV writing. I wouldn't do that for anyone though, I used my instinct. His story didn't completely add up, and there were clearly MH issues. He had our mobile number in case there was an emergency. We asked him not to come round without checking in advance by text and he respected that. I think in the end we intervened at the right moment as he's now reunited with family.