Modi stood with his hands folded in front of massive golden statues of the Buddha as orange-robed monks chanted prayers.
"Sutra recitation at Grand Hall of Daxingshan Temple in presence of PM," tweeted external affairs ministry spokesperson Vikas Swarup.
The temple is located on Xingshansi West Street in the business quarter Xiaozhai of southern Xi'an. The temple was originally built in the Jin Dynasty and was extended in the Sui Dynasty.
After its reconstruction in 582 AD, it was called the Da Xingshan temple.
Xi'an is the capital of Shaanxi province and the hometown of President Xi Jinping. Modi and Xi are scheduled to hold their summit meeting later.
Xi'an is also associated with Chinese traveler and famous Buddhist scholar Xuan Zang or Hieun Tsang who travelled extensively in India in 629 to 645 AD. A AModi was earlier accorded a grand welcome at the airport on arrival.