1. He was ashamed of having no money.

2. He was ashamed to have no money.
3..He was ashamed because he had no money.
(Are they all the same and grammatical? Can we substitute 'shy' for 'ashamed'?)

All are correct and mean the same thing.

But, no, 'shy' is not the same thing as 'ashamed.'