Why at end of all rituals and prayers we chant श्री कृष्ण अर्पण अस्तु (Sri Krishna arpan mastu)? Can Rama or Shiva names replace Krishna's name? From which scripture is this phrase taken?
It isn't necessary that all prayers and rituals should end with "Shree Krishnarpanamastu".
There were also rituals before the birth of Lord Krishna.
"Shree Krishnarpanamastu" means "I offer this prayer to Krishna"
If the prayer is done for Lord Rama then at last "Shree Ramachandrarpanamastu" or "Shree SitaRamaChandrarpanamastu" is spoken meaning "I offer this prayer to Lord Rama" or "I offer this prayer to Sita Rama" Similarly for prayers done for LordShiva "Shivarpanamstu" and similar terms are chanted meaning "I offer this prayer to LordShiva.
For eg In the popular RamaRaksha Stotram at the last:
I offer this prayer to Sita and Rama.
In the prayer there is 'Prityartham' part which denotes prayer is done for pleasing whom. For eg .
In Rama Raksha Stotra:
(This hymn is) for pleasing Sita and Rama
Thus as this hymn is for pleasing Sita and Rama, at last "ShreeSitaRamaChandrarpanamastu" is chanted denoting "Offering to Sita and Rama"
In Shiva Raksha Stotra:
श्री सदाशिव प्रित्यर्थम्
Shree SadaShiva Prityartham
(This hymn is) for pleasing SadaShiva.
Thus as this hymn is for pleasing SadaShiva hence at last "Shree SadaShivaarpanamastu" is spoken meaning "I offer this prayer to SadaShiva".
One may also chant "Shree Krishnaarparnamstu" in every prayer thinking that every prayer finally reaches to Lord Krishna. But it is his own belief.
Hymn is offered to him for whose pleasure that hymn is chanted ie. Hymn is offered to that Lord whose name is in "Prityartham" Part.