It is a theorem due to Blumberg (*New Properties of All Real Functions* - Trans. AMS (1922)) and a topological space $X$ such that every real valued function admits a dense set on which it is continuous is sometimes called a Blumberg space. Moreover, in Bredford & Goffman, *Metric Spaces in which Blumberg's Theorem Holds*, Proc. AMS (1960) you can find the proof that a metric space is Blumberg iff it's a Baire space.