So Prophet Mauhammad (pbuh) rose into the presence of Allah SWT, and it is described that between him and Allah SWT was one veil.
Prophet Mauhammad (pbuh) then thought, “I’ve come to the Creator, and I didn’t bring a gift? What could I bring Him? He owns everything!”
So Prophet Mauhammad (pbuh) said to Allah SWT:
“
At Tahiyyaatu lilaahi was Salawaatu wat tayibaatu”
“All greetings, blessings and good acts are from You, my Lord.“
Then Allah SWT responded:
“As Salaamu ‘alaika ayyuhan nabiyyu wa rahmatul laahi wa barakaatuh”
“Greetings to you, O Prophet, and the mercy and blessings of Allah.”
The Malaikat then said:
“As Salaamu ‘alainaa wa ‘alaa ‘ebaadillaahis saaliheen,”
“Peace be unto us, and unto the righteous servants of Allah.“
Prophet Mauhammad (pbuh) then said:
“Ash hadu allaa ilaah ilallaah
Wa ash hadu anna Muhammadan ‘abduhuu wa rasuuluh”
“I bear witness that there is none worthy of worship except Allah.
And I bear witness that Muhammad is His servant and messenger.“
This is the conversation that we Muslims recite in our Salat daily, that Allah SWT had with the beloved Prophet at such great closeness. Not many people realize its great significance
http://themuslimvoice.wordpress.com/.../30/tashahhud/
Can't find the original I read but it is similar to the one on this blog..& that's how tashahud came to be..
and Allah swt knows best