Many semiconductor and IC companies have a free sample program. Usually the sample program is for educational institutional use or for commercial prototyping and/or product evaluation for production use.
Using samples for personal projects can be honest (and legal) or dishonest (and possibly illegal). It depends primarily on the company you're dealing with and your behavior.
If the company just says they'll hand out samples to anyone who wants them, and you ask and they're happy to send you some, then you're just fine.
If the company explicitly states that the samples are only available for commercial evaluation purposes, then you're borderline - if you ask for a sample and say that you're not using it for commercial purposes, and they send it to you, then that's probably acceptable - you've acknowledged their policy and the company has chosen to go against it.
If the company has the policy described above and either states that samples are only for commercial evaluation and you just order a sample, or if you give the whole spiel about how you're evaluating this part for use in a production of some large number of products per year, etc. etc., then you're lying, it's dishonest, and it's illegal. I have talked to people who do this, and mostly they come up with all kinds of excuses for why it's ok, but it's not. It's wrong.
As to any risks that you face using a sample program - if you're honest about your purposes, and they send you a sample, there's probably not anything to worry about. If you misrepresent yourself and your reasons for requesting a sample, then you could potentially face legal action - although I doubt it would happen.