Electromagnetic signals in circuits consist of discrete photons, though conventional voltage sources can only generate classical fields with a coherent superposition of many different photon numbers. While these classical signals can control and measure bits in a quantum computer (qubits), single photons can carry quantum information, enabling non-local quantum interactions, an important resource for scalable quantum computing. Here, we demonstrate an on-chip single photon source in a circuit quantum electrodynamics (QED) architecture, with a microwave transmission line cavity that collects the spontaneous emission of a single superconducting qubit with high efficiency. The photon source is triggered by a qubit rotation, as a photon is generated only when the qubit is excited. Tomography of both qubit and fluorescence photon shows that arbitrary qubit states can be mapped onto the photon state, demonstrating an ability to convert a stationary qubit into a flying qubit. Both the average power and voltage of the photon source are characterized to verify performance of the system. This single photon source is an important addition to a rapidly growing toolbox for quantum optics on a chip.