According to Smithsonian Magazine, caffeine is structurally similar to a biochemical called adenosine. This chemical, among other things, is responsible for making us sleepy.
When you have a cup of coffee, the caffeine binds with your brain's adenosine receptors. This blocks actual adenosine from binding with those receptors and making you tired.
It's sort of like caffeine is stealing adenosine's parking space, which means adenosine has to circle the lot in search of another place to park. As it does, the surplus adenosine actually causes your brain to produce adrenaline, which is another stimulant. Removing the adenosine and adding the adrenaline contributes to that energized, unstoppable feeling you get after consuming caffeine.
Interestingly, the brains of heavy caffeine users actually grow additional adenosine receptors. This is why it takes more caffeine to give a coffee addict them the same jolt as a small cup might give to a non-drinker.
Source : https://www.thisisinsider.com/what-caffeine-does-to-your-brain-and-body-2018-7163