Kinetic Monte Carlo methods such as the Gillespie algorithm model chemical reactions as random walks in particle number space. The interreaction times are exponentially distributed under the assumption that the system is well mixed. We introduce an arbitrary interreaction time distribution, which may account for the impact of incomplete mixing on chemical reactions, and in general stochastic reaction delay, which may represent the impact of extrinsic noise. This process defines an inhomogeneous continuous time random walk in particle number space, from which we derive a generalized chemical master equation. This leads naturally to a generalization of the Gillespie algorithm. Based on this formalism, we determine the modified chemical rate laws for different interreaction time distributions. This framework traces Michaelis-Menten-type kinetics back to finite-mean delay times, and predicts time-nonlocal macroscopic reaction kinetics as a consequence of broadly distributed delays. Non-Markovian kinetics exhibit weak ergodicity breaking and show key features of reactions under local nonequilibrium.