In this paper, we show that abstract planar algebras are algebras over the topological operad of moduli spaces of stable maps with Lagrangian boundary conditions, which in the case of the projective line are described in terms of real rational functions. These moduli spaces appear naturally in the formulation of open string theory on the projective line. We also show two geometric ways to obtain planar algebras from real algebraic geometry, one based on string topology and one on Gromov-Witten theory. In particular, through the wellknown relation between planar algebras and subfactors, these results establish a connection between open string theory, real algebraic geometry and subfactors of von Neumann algebras.