In carbonic acid, carbon is bonded to two oxygen atoms through double bonds and to two hydroxyl (OH) groups through single bonds. The electronegativity of oxygen is higher than that of carbon, so the oxygen atoms attract electrons away from the carbon atom, giving it a positive charge.
The oxidation number of an element represents the number of electrons that it has gained or lost in a compound. In carbonic acid, carbon has lost four electrons, two to each oxygen atom, resulting in an oxidation number of +4.