Caffeine is not optically active because it is a planar heterocycle. When you say optically active, it means that compounds have molecules which are chiral. Chirality is the property of molecules as a result of its structure. And when you say planar heterocycle, molecules are flat and the ring should contain atoms located in a similar plane.