The racing aspect of Porsche has been part of the DNA even before it was a formally established company. Ferdinand Porsche designed highly successful Grand Prix cars in the 1920s and 1930s both for Mercedes and Auto Union.
The Porsche company started building it's own cars in 1948, and in under a decade was building highly competitive sports car racers. Through the late 1950s, they continued to evolve their sports car models, and kept winning with a series of small, lightweight mid and rear engine and cars.
By 1957, the Porsche 718 RSK was introduced, and quickly became highly successful in closed wheel sports car racing. Interestingly, at that time, the Formula 2 series was running similar displacement to the RSK (1.5 liters), and the rules otherwise permitted it to run in the class.