Is it common that my work is wasted since a collaborator who is the first author does not submit the manuscript that I have worked on?
If your contribution is just to the writing and not to the underlying research then you don't have much invested. However, if it helped you improve your writing skill in any way then it isn't wasted. 

But the best way to capitalize on it directly is to stay with the project if it continues but get more deeply into the research behind it. 

But don't minimize the impact of the experience. Think of it as an investment that will only pay off longer term. I assume the first author also put a lot into the work and is a bit disappointed also. 

But you should verify everything with your supervisor/advisor. Perhaps the other student is being overly pessimistic. 

OTOH, discarding work partly done is common enough. Not the norm, perhaps, but sometimes you need to get fairly deep into it to learn that there is less there than first anticipated.