Tadpoles start out as water breathers before becoming air breathers. Fish use gills to breathe by essentially "washing" the water containing oxygen over a system of blood vessels in order to extract the oxygen. But because a tadpole has both lungs AND gills, it has a little "cap" (the glottis) that functions to block water from reaching the lungs, while allowing oxygen a way in.
This is the same way our "cap" functions between our mouth, with which we use to breathe AND eat (called the epiglottis in humans). So, the mouth connects to the lungs and the stomach through two separate pipes, one in front of the other: the trachea and the esophagus. The "cap" closes the airway so that food/liquid can't go in there.
As a result, we hiccup because our bodies are trying to prevent us from breathing in solids and liquids. Once our brain senses that something is going down a pipe where it's not supposed to, it sends a message to that "cap" to shut quickly! Hence, our HIC! in hiccup.