Hay sometimes causes impacted crops. Which can be serious. OTOH there are a number of people using hay longterm who've not had problems, so, depends on your risk tolerance.
Nothing wrong with straw or shavings, many people use those too quite successfully. Or shredded paper, or various other things. Personallly I'm partial to shavings.
Some people feel their chickens kick <one material> out of the nestbox less than they kick <one or more other materials> out, but that varies so much among people that I have a strong feeling it depends more on individual nestbox design and individual chicken personalities than there being any overall reliable *trend* in it.
Honestly, I think it mainly comes down to having something reasonably cushiony and easily-spot-cleaned that is sufficiently nontoxic/nondangerous for your personal tastes. And a high lip on the nestbox opening. Within those constraints there are lots of materials all of which work approximately equally well.
Good luck, have fun,
Pat