Is this sentence correct grammatically?

If you replace way by thing, then your sentence is grammatical and makes sense:

Pretending to be a beggar on the street was the only thing such a shameless individual as you could do.

This works because you can do things but you cannot do ways. For example,

  • Begging was the only thing (that) she could do.

  • ?Begging was the only way (that) she could do.

However, you can have ways. So your friend's suggestion:

Pretending to be a beggar on the street was the only way such a shameless individual as you had

is grammatical and makes sense