名留青史 is a variant of the more standard
名垂青史. The image traces back to Du Fu's Tang poem
《赠郑十八贲》:
古人日以远,青史字不泯 ('the ancients recede day by day, but their names on the green-bamboo histories never fade').
青史 'green history' = old bamboo-strip chronicles.