The gyrokinetic simulation code AstroGK is developed to study fundamental aspects of kinetic plasmas and for applications mainly to astrophysical problems. AstroGK is an Eulerian slab code that solves the electromagnetic Gyrokinetic-Maxwell equations in five-dimensional phase space, and is derived from the existing gyrokinetics code GS2 by removing magnetic geometry effects. Algorithms used in the code are described. The code is benchmarked using linear and nonlinear problems. Serial and parallel performance scalings are also presented.