Why is coffee a stimulant?
Drowsiness is caused by the chemical adenosine binding to a nerve cell's adenosine receptor. A compound that binds and elicits a response, in this case a slow down of nerve activity, is called an agonist.

Caffeine is also capable of binding to the adenosine receptor. However, it does not elicit a response and no drowsiness is experienced. This type of compound, binds with no response, is called an antagonist.

When caffeine is in your system it blocks the nerve cell from "seeing" any adenosine, causing the cell to increase activity. This increase of neural activity is interpreted by the brain as an emergency resulting in the release of adrenaline, the "fight of flight" hormone.

Caffeine stops you from being drowsy, speeds up your nerve activity, and gives you an adrenaline rush. All of these interfere with sleep.