The dynamical interaction of a newly formed protostar with infalling matter - The origin of interstellar grains