Early years (1904–1917)
Shastri was born at the house of his maternal grandparents in Ramnagar, Varanasi in a Hindu family, that had traditionally been employed as administrators and civil servants. Shastri's paternal ancestors had been in the service of the zamindar of Ramnagar near Varanasi and Shastri lived there for the first year of his life. Shastri's father, Sharada Prasad Srivastava, was a school teacher who later became a clerk in the revenue office at Allahabad, while his mother, Ramdulari Devi, was the daughter of Munshi Hazari Lal, the headmaster and English teacher at a railway school in Mughalsarai. Shastri was the second child and eldest son of his parents; he had an elder sister, Kailashi Devi (b. 1900).
In April 1906, When Shastri was hardly one year old, his father, had only recently been promoted to the post of deputy tahsildar, died in an epidemic of bubonic plague. Ramdulari Devi, then only 23 and pregnant with her third child, took her two children and moved from Ramnnagar to her father's house in Mughalsarai and settled there for good. She gave birth to a daughter, Sundari Devi, in July 1906. Thus, Shastri and his sisters grew up in the household of his maternal grandfather, Hazari Lal. However, Hazari Lal himself died from a stroke in mid-1908, after which the family were looked after by his brother (Shastri's great-uncle) Darbari Lal, who was the head clerk in the opium regulation department at Ghazipur, and later by his son (Ramdulari Devi's cousin) Bindeshwari Prasad, a school teacher in Mughalsarai.
In Shastri's family, as with many Kayastha families, it was the custom in that era for children to receive an education in the Urdu language and culture. This is because Urdu/Persian had been the language of government for centuries, before being replaced by English, and old traditions persisted into the 20th century. Therefore, Shastri began his education at the age of four under the tutelage of a maulvi (a Muslim cleric), Budhan Mian, at the East Central Railway Inter college in Mughalsarai. He studied there until the sixth standard. In 1917, Bindeshwari Prasad (who was now head of the household) was transferred to Varanasi, and the entire family moved there, including Ramdulari Devi and her three children. In Varanasi, Shastri joining the seventh standard at Harish Chandra High School. At this time, he decided to drop his caste-derived surname of "Srivastava" (which is a traditional surname for a sub caste of Kayastha families).