We have investigated the cross section for the π−p→K0πΣ and pp→pK+πΣ reactions paying attention to a mechanism that develops a triangle singularity. The triangle diagram is realized by the decay of a N∗ to K∗Σ and the K∗ decay into πK, and the πΣ finally merges into Λ(1405). The mechanism is expected to produce a peak around 2140 MeV in the KΛ(1405) invariant mass. We found that a clear peak appears around 2100 MeV in the KΛ(1405) invariant mass which is about 40 MeV lower than the expectation, and that is due to the resonance peak of a N∗ resonance which plays a crucial role in the K∗Σ production. The mechanism studied produces the peak of the Λ(1405) around or below 1400 MeV, as is seen in the pp→pK+πΣ HADES experiment.