Er ist nur fünf Jahre alt geworden.
Can it mean
(a) He only just became five years old.
(b) He lived only to five years old (and died).
or both?
Definitely (b) and (b) only. To express (a) in German, you'd use something like
Er ist gerade erst fünf geworden. (He only just turned five.)
Er is gerade mal fünf Jahre alt. (He's only five years old).
Maybe as a little add to the existing answer, it would be helpful to pinpoint where does this confusion arise.
In English you use the adverb only, just, ... (or it's synonims) to narrow a quantity, a situation, etc. When these turn out to be of temporal character, one no longer uses nur but erst, or gerade erst, as in teylyn's answer.