The mechanism for the formation of the Λ(1405) resonance is studied in a chiral quark model that includes quark-meson as well as contact (four point) interactions. The negative-parity S-wave scattering amplitudes for strangeness −1 and 1 are calculated within a unified coupled-channel framework that includes the KN, KˉN, πΣ, ηΛ, KΞ, πΛ, and ηΣ channels and possible genuine three-quark bare singlet and octet states corresponding to 21− resonances. We show that in order to reproduce the scattering amplitudes in the S01 partial wave it is important to include the pertinent three-quark octet states as well as the singlet state, while the inclusion of the contact term is not mandatory. The Laurent-Pietarinen expansion is used to determine the S-matrix poles. Following their evolution as a function of increasing interaction strength, the mass of the singlet state is strongly reduced due to the attractive self-energy in the πΣ and KˉN channels; when it drops below the KN threshold, the state acquires a dominant KˉN component which can be identified with a molecular state. The attraction between the kaon and the nucleon is generated through the KˉNΛ∗ interaction rather than by meson-nucleon forces.