How should I proceed when a (famous) professor says I'm not good enough for research?
I am sorry that it happened to you. This is not a pleasant experience, and frankly it's a shame that toxic professors and supervisors are still common in academia.
Academic research is broad and multi-dimensional. Some people excel in writing proofs, others design and set up wonderful experiments, collect useful data and find beautiful dependencies within. Some people propose fantastic theorems, which take hundred years to prove, others prove or disprove them after hundred years. As a community, we do research in a variety of exciting ways, which mutually support each other.
No single researcher is equally excellent in doing all these things. We have our strong areas and our blind spots. But saying that someone is not fit for research based on a couple of shortcomings in their proof is completely unfair, unjustified, ridiculous and unkind. This is opposite what a University professor should do, in my opinion. A good supervisor would encourage a student to try different things to identify where their strength and passion are. A toxic person would identify a single error and draw far-reaching conclusions from it to undermine student's confidence and make them feel bad about themselves. This is an extremely short-sighted and unprofessional behaviour.
Please try to disregard this person's opinion. Find someone else to collaborate with. Academia is large and although toxic and self-important people are still common, there is also a plenty of kind and supportive and truly generous colleagues around. Don't hesitate to share your experience with others to prevent someone else from having the same negative experience as you just had.