Here's the way it works.
Caffiene stimulates the central nervous system (CNS). The body perceives the stimulation to be a threat to homeostasis, so to compensate, it kicks up the parasympathetic nervous system (PNS) to calm you down.
Since the stimulation is exogenous (ie, caused by a force external to the body), once the caffiene has been metabolized and is no longer stimulating your CNS, the PNS can operate unopposed, leaving you sleepy.
I think.
There's also a phenomenon called paradoxical pharmacology where stimulants are actually sedatives for some people, and vice versa.