Yes, you can. There are various stores and vendors in the game where you can purchase hats.
Sure. You can find hats for sale at different locations throughout the GTA 5 story mode. Some are available in clothing stores, while others might be from specific NPC vendors. It just depends on where you look.