The Oscar winner is in Edinburgh to speak at the Scottish Business Awards at the EICC.
DiCaprio visited Home, a restaurant in Queensferry Street which gives its profits to the homeless.
Hundreds of fans were waiting for his arrival. Many had queued in the rain for hours.
Last year George Clooney visited Social Bite in Rose Street.
Clooney's visit was arranged by entrepreneurs Tom Hunter and Josh Littlejohn, the co-founder of Home and Social Bite, ventures that help the homeless community by allowing customers to pay for food and drink for the vulnerable.
Home provides training and employment programmes for members of the Social Bite Academy, a four-year paid course for homeless people.
DiCaprio made no comment to the waiting media as he shook hands with Mr Littlejohn and went inside the building.
Elise Lovell, 45, was the winner of a competition to have lunch with Hollywood star.
She said she had bought eight tickets and felt like she had won the Lottery.
Ms Lovell said Di Caprio was "absolutely charming".
She said they talked about his films and his work with director Martin Scorsese, his environmental work and the election of Donald Trump as US president.
Ms Lovell said: "He said it was definitely a shock."
Fan Carol Honeyman left her house in Larbert at 05:00 to see DiCaprio.
She carried a large canvas of a scene from The Departed, which the movie star signed.
She said: "I don't really know why I do these things but it was so worth it.
"I got this canvas signed before by Ray Winstone, and now it's complete with Leo's.
"I've actually met him before when I went down to the Baftas in London but it's just nicer to say I've seen him closer to home. He's a star."
Sonny Murray, 37, who works at Social Bite, met DiCaprio at Home. He said: "I caught him checking himself out in the mirror."
Maria Luisa, 65, from Edinburgh, said she was probably the oldest fan there.
She said DiCaprio shook her hand, adding: "He didn't spend long enough with crowd."
Home is a not-for-profit venture opened in September, with a menu of French and Scottish cuisine.
Diners are encouraged to "pay forward" meals for the homeless, who can attend a special service for those sleeping rough every Monday between 15:00 and 17:00.
Leonardo DiCaprio won his first Oscar earlier this year for survival epic, The Revenant.
The star of Titanic and the Wolf of Wall Street had been nominated six times.

European football's governing body has opened disciplinary proceedings against the Danish champions for supporters in the away end "setting off fireworks".
Uefa holds host clubs responsible for security inside and around the stadium, "unless they can prove that they have not been negligent".
Leicester won the game 1-0.
Uefa's control, ethics and disciplinary body will deal with Copenhagen's case on 17 November.
Elsewhere, three Polish football fans were arrested in Spain on Tuesday hours before Legia Warsaw's Champions League meeting with Real Madrid, AFP reported.
The three supporters, aged 31, 33 and 34, are alleged to have attacked waitresses in a bar in the La Latina district of Madrid, stealing the mobile phone of one woman and attempting to rob cash from the till, a police spokesperson told the news agency.
Legia have already been made to play their home game against Real, on 2 November, behind closed doors.
The Polish champions were punished by Uefa last week for racist behaviour and fighting among the home fans during a 6-0 defeat by Borussia Dortmund.
Subscribe to the BBC Sport newsletter to get our pick of news, features and video sent to your inbox.

23 June 2014 Last updated at 14:32 BST
Two men from the city have been identified taking part in what appears to be a Jihadist recruiting video, which was posted online last week.
It is thought Reyaad Khan travelled to Syria with friend Nasser Muthana who also appears in the footage.
An expert on radicalisation, Dr Suraj Lakhani of Cardiff University, said: "As far as I'm aware, there has been an issue in Cardiff for a while now."
Nicky Smith spoke to one of the families and the local community, while Jordan Davies speaks to Sheikh Zane Abdo, Imam at the South Wales Islamic Centre.
Hollywood actor Leonardo DiCaprio has signed autographs outside an Edinburgh restaurant in what is thought to be his first visit to Scotland.
[NEXT_CONCEPT]
Leicester City will not face Uefa charges after FC Copenhagen fans let off flares before Tuesday's Champions League game at the King Power Stadium.
[NEXT_CONCEPT]
Cardiff has an ongoing problem with the radicalisation of young Muslims, said an academic who has studied the issue.