In general, introductory adjectival and adverbial phrases (and clauses) are separated by a comma.
Commas serve a few primary purposes: to clarify phrase and sentences structure, to indicate elements in a series, and to reflect natural speech patterns. When separating introductory phrases or clauses, they serve to clarify structure and reflect flow.
When I was a lad, I served a term as office boy to an Attorney's firm.
The comma suggests a pause, as would naturally occur in the oral rendition. It also helps clarify that it is incidental to the main clause, I served a term. But this is a convention. In most printed versions of Gilbert & Sullivan's ditty, the comma is omitted.
When the introductory adjective or adverb is a singly word, the use of a comma depends on the flow more than logic.
Yesterday I went to the store.
A comma is not needed because, for most speakers, the sentence would flow without a pause.
Yesterday, all my troubles seemed so far away
The comma reflects a pause in the sentence. Is it necessary grammatically? No. But if you listen to the recording, you can hear the comma.
Once there was a silly old ram
Once upon a time, there was a silly old ram.