When Emperor Maximilian formed Landsknecht companies in 1480s, he allowed them to dress however they wanted, ignoring strict sumptuary laws at the time that restricted clothing by social rank.
His reasoning was that because their lives were "brutish and short", they should be allowed to have little fun and pride.
This led to Landsknecht mercenaries dressing as flamboyantly as possible, taking full advantage of this exemption, giving us these amazing warrior aesthetics!
To give some more context.
From the late Middle Ages into the 18th century, strict sumptuary laws were in effect in the Holy Roman Empire. These laws were meant to keep social classes visually distinct by limiting who could wear certain clothes. The prohibitions included banning certain fabrics and even specific fashion styles.
Non-nobles would generally be banned from wearing silk, velvet, gold, silver and pearls; they were also forbidden flamboyant fashion styles like extreme slashing, huge puffs and oversized feathered hats.
The laws existed because, contrary to modern stereotypes about the period, there were a lot of wealthy commoners at the time (merchants, successful artisans, wealthy peasants etc.) who could technically afford the same luxurious clothes and fabrics as nobles. In order to distinguish the social ranks and enforce hierarchy, laws were enacted that banned or limited specific types of clothes to most social classes, so that the nobles would continue to stand out, and hierarchy among classes would be visually recognized.
The first city-level "Kleiderordnungen" (clothing ordinances) appeared from the 13-14th centuries onward, and by 15th century they were becoming common all over Holy Roman Empire, differing slightly from city to city. In 1530 the Diet of Augsburg issued imperial dress regulations.
However Landsknecht mercenaries were given a formal exemption at Diet of Augsburg in 1503 and were allowed to "dress as they see fit".
Landsknechts took full advantage of that and deliberately dressed as flamboyantly as they could, wearing colorful, slashed, and puffed clothing. The ones who could afford it wore the finest materials like silk and gold chains. The look was deliberately ostentatious to signal their status.
A Landsknecht mercenary of lowly origin could suddenly dress in better fabrics and wore more flamboyant clothes than wealthy merchants, having the same fashion privileges as the most powerful nobles. So there was definitely a lot of pride involved in dressing like this and showing off.
One could image how impressionable youths at the time saw Landsknechts dressed like this and wanted to join them. In this way, you can see how Emperor Maximilian giving them this exemption was a way to increase recruitment and promote mercenary lifestyle, at the time when he badly needed pike infantry of his own to counter the Swiss pikemen.
There were also some practical reasons for why Landsknecht clothing looked the way it did. Late medieval civilian clothing was often tight and restrictive. Slashing the outer fabric (especially sleeves, shoulders and hose) let the garment expand and move more freely when marching or fighting with a long pike. Silk was preferred because it didn't stick in wounds as much as linen.
At the time, uniform clothes for soldiers did not exist yet and while on campaign, Landsknechts often had to use whatever cloth they could get to repair their damaged garments. The deliberate slashing style made it easy to insert or display a contrasting lining or patch without needing skilled tailoring.
So the iconic Landsknecht fashion was a mix of being given the privilege to wear what they wanted and some practical reasons.
It was a fashion befitting of a warrior lifestyle!