An undertunic is simply a tunic of a lightweight cloth (generally linen) worn under a tunic or kyrtle. Generally the undertunic is shorter in the body than the outer garment.
When the undertunic became/was replaced by the shirt is open to debate.