Tomic had just dropped the first set 6-4 to the world No.1 when he called it a night.
The 21-year-old said he first suffered the injury on Monday and only took the court against Nadal after taking "a lot of tablets".
"I was trying to get the pain to go away," he said.
"As soon as I felt on court today hitting, I started feeling the pain."
The writing was on the wall when he sought a medical time-out after just three games.
He complained of having difficulty pushing off on his left leg, but emerged a few minutes later with his left thigh strapped.
Feeling uncomfortable, Tomic discarded the strapping shortly and managed to keep pace with Nadal until the top seed broke him in the ninth game and served out the opening set after 42 minutes.
"It's tough playing Rafa with two legs, let alone one. Nothing I could do," he said.
When Tomic advised the umpire that he was unable to play on, fans at Rod Laver Arena booed.
"I don't think they quite knew what was wrong with me," Tomic said.
"After, when I told them it was my leg, they sort of started to be on my side, which is good that I heard that in the end from their applause."
Tomic said he would have loved to have been able to play on against one of the game's all-time greats.
"This opportunity I had to play against Rafa was huge for me. Could have used a lot of it," he said.
"I would have loved nothing but to get on that court and give it all I got, which I was doing, but just hurting myself."
Nadal, who had to retire from his 2011 quarter-final against Spanish countryman David Ferrer with a hamstring injury, sympathised with Tomic.
"It is very tough to go out of a tournament like this when you are playing at home, when you are playing night session with full crowd," he said.
"I felt really sorry for Bernard. I was in that situation a few years ago and I know how tough is to take that decision.
"But if you feel bad, there is no reason why you have to continue. You put in risk the next tournaments for nothing.
"I hope he gets better very soon ... I wish him all the best for the rest of the year."
Tomic will have scans on Wednesday and said he remained hopeful of being fit for Australia's Davis Cup tie against France in two weeks.
Nadal, meanwhile, next faces another Australian youngster in Thanasi Kokkinakis on Thursday after the teenage wildcard upset Dutchman Igor Sijsling 7-6 (7-4) 0-6 7-6 (7-3) 6-2 on his grand slam debut earlier on Tuesday.