We consider Kobayashi geodesics in the moduli space of abelian varieties Ag, that is, algebraic curves that are totally geodesic
submanifolds for the Kobayashi metric. We show that Kobayashi geodesics can be characterized as those curves whose logarithmic
tangent bundle splits as a subbundle of the logarithmic tangent bundle of Ag.
Both Shimura curves and Teichm¨uller curves are examples of Kobayashi geodesics, but there are other examples. We show moreover that non-compact Kobayashi geodesics always map to the locus of real multiplication and that the Q-irreducibility of the induced variation of Hodge structures implies that they are defined over a number field.