The others have given very good advice. Just to add on what they mentioned:
1) You need to separate both guys, there are two different issues.
2) You acted appropriately with your friend. He made advances and you backed away like a girlfriend should. So I commend you for that.
3) We have no idea what your boyfriend saw. I thought that maybe he tried to find you after 6pm, but he couldn't because you were not at home. So since he's already a very insecure person, this just adds to his insecurities.
4) If he saw you with that guy, it really sounds like he's stalking you. I'm not sure if you're freaked out by it, but I would be.
5) There is the whole trust issue. If he's angry for whatever reason, you really need to find out what's on his mind. I think you should have told him that you stayed out later than normal with a friend and that your friend made advances, but you refutted those advances. But like I said, we have no idea why your boyfriend is hiding away until you ask him, so no point guessing.
6) Remember how I said to separate both guys. As for your boyfriend, it sounds like he might not be the type of guy that matches you very well. If you're not the jealous type of person but he is, then there's a huge imbalance. You already admitted that you can't change a person, so unless you can accept the way he is, there's always going to be a rift between the two of you. I'm just not sure that's healthy in a relationship, but that's your decision.