The kepi is a cap with a flat circular top and a peak, or visor. Etymologically, the term is a loanword of the French képi, itself a re-spelled version of the Alemannic Käppi: a diminutive form of Kappe, meaning "cap". In Europe, this headgear is most commonly associated with French military and police uniforms, though versions of it were widely worn by other armies during the late 19th and early 20th centuries. In North America, it is usually associated with the American Civil War, as it was worn by soldiers on both sides of the conflict.

The kepi was formerly the most common headgear in the French Army. Its predecessor originally appeared during the 1830s, in the course of the initial stages of the occupation of Algeria, as a series of various lightweight cane-framed cloth undress caps called casquette d'Afrique. These were intended as alternatives to the heavier, cloth-covered leather French Army shako. As a light and comfortable headdress, it was adopted by the metropolitan (French mainland) infantry regiments for service and daily wear, with the less practical shako being relegated to parade use.

More Info: en.wikipedia.org