When Gotama, after leaving home, entered Giribbaja (Rájagaha) for alms, Bimbisára saw him go and sent messengers to discover his whereabouts. They reported that Gotama was taking his meal under the shadow of the Pandavapabbata. There Bimbisára visited him and requested him to share his kingdom. Gotama told Bimbisára of his antecedents, that he was a Sákyan of Kosala and had renounced all pleasures, seeing ill in them (SN.vs.405 24).
Buddhaghosa explains (SNA.ii.381) that the Sutta was preached by Ananda at Jetavana, because he desired to give an account of the renunciation of the Buddha, similar to that of Sáriputta and others. The Commentary adds (p.386) that at the end of the talk with the Buddha, Bimbisára asked him to visit Rájagaha as soon as he had attained Enlightenment.