'Shark Tank' star Robert Herjavec explains how he figured out what to do with his life when he was 21

Robert Herjavec
David A. Grogan | CNBC

At 55 years old, Robert Herjavec has found great success. He is the founder and CEO of cybersecurity firm Herjavec Group, a star of ABC's "Shark Tank," and a best selling author. But when he was 21, he was lost.

"I didn't know what I wanted to do. I was a bit of a mess, partying, hanging out," he says on Sunday's episode of "Shark Tank." "People would say, 'What do you want to do with your life?' I'd go, 'Ah, it doesn't matter.'"

As a young person, Herjavec had odd jobs like delivering newspapers and waiting tables. Then, a conversation with his father changed his perspective, and helped him to find the drive to succeed.

"My dad sits down with me, and he says 'I went through hell so that you could have the opportunity I never had,'" Herjavec reveals on "Shark Tank."

For his father, that hell began in Croatia, formerly Yugoslavia, where he was persecuted for speaking against Communism.

"My dad was thrown in jail 23 times," Herjavec says on "Shark Tank."

When Herjavec was 8, his dad escaped from jail and rushed the family to Canada, where they arrived with only $20 and a suitcase to call their own. And, life in a new country wasn't easy.

"My dad was a factory worker. When we came here, he worked in a factory and swept floors," Herjavec says during a 2012 episode of 'Shark Tank.' "People made fun of him, because he wasn't American. They called him all kinds of names, and it hurt him deeply."

To get to work, his father would walk two miles each way to the factory in order to save bus fare. At times, Herjavec was embarrassed of his dad and the family's poverty.

"He was poor, he was rough around the edges and I just didn't want to be like that," Herjavec tells Inc. "When I was growing up, I was really embarrassed of him."

But the sit down as a 21-year-old changed his outlook, and taught him a lesson about seizing opportunities.

"Now, I realize the sacrifice that he went through, in order to give me this opportunity," Herjavec explains to Inc. "I had this incredible sense of desperation that if I didn't do something with my life, all the sacrifice wasn't worth it."

He went on to get a job selling IBM products at Logiquest, and fell in love with technology. Now, his cybersecurity business has nearly 300 employees, according to Fortune. And still, that lesson from his dad continues to motivate him.

"People have said 'How do you work so hard? You only sleep three hours a day!'" Herjavec says on "Shark Tank." "Anything I do in my lifetime will never be as hard as what that man went through."

Don't miss: Mark Cuban gives a 17-year-old who pitched him on 'Shark Tank' his top advice for getting ahead

Like this story? Like CNBC Make It on Facebook!

Disclaimer: CNBC owns the exclusive off-network cable rights to "Shark Tank."

This story has been revised and updated.

Shark Tank’s Robert Herjavec: Easy ways to keep your data safer
Shark Tank’s Robert Herjavec: Easy ways to keep your data safer