Latin papilio meant butterfly. The word travelled through French and Middle English; Etymonline explains the tent sense by a resemblance to wings.
The tent sense was already present in Medieval Latin. The cards select one spelling for each stage; alternative English spellings are not separate steps.
Sources
- Merriam-Webster: pavilion
Noun Word History gives the Latin meaning and route through Anglo-French to the Middle English spellings.
- Etymonline: pavilion
The noun entry supplies Old French paveillon, the Medieval Latin tent sense and the wing-shape explanation.