I understand where you are coming from, I also understand that this could be a frustrating situation for you. However I would like to give a little of my perspective on this, and I think it may disagree with yours quite a lot.
That being said, the reason society and its laws disproportionately protect trespassing homeless people over people in your position I think is relatively simple. One of you is a person at the very bottom of life, with presumably no relatives willing and able to help him, very little money, very poor mental health, possibly quite poor physical health, and who has so few options available to him (at least from his point of view) that he has resorted to trespassing. The other is a person who has a house, internet access, relative financial stability and who is able to protect himself so well that he is bragging about it to strangers online. So one of you desperately needs empathy and protection from society and the other is perfectly fine on his own. This is the reason the system disproportionately protects the homeless man on your driveway: because he is one of society's most vulnerable members. Both of you are deserving of help/protection from the system, but only one of you needs it.
On a more general note, sometimes feeling the urge to be violent towards another person is very natural. I also agree that it is the case that male hormones can make these feelings more prevalent, so it is at least somewhat a gendered phenomenon. The way I deal with feeling the need to physically attack another person (for whatever reason the situation may seem to demand) is by focusing on the other person's perspective and by appealing to their humanity when I interact with them. For example by practicing a little bit of sympathy towards them. In your case I might have asked if the homeless person was okay, if he wanted some water or some spare change or some food etc. After that I would have explained to him that I can't have him staying on my driveway and that I need him to leave. If that had not worked then probably I would call the police or ask neighbours for help etc. If I were a woman or a young teenager then I would not risk that and I would just go straight to calling the police or neighbours. The point is to deal with the situation in a way that no one gets hurt.
I'm a bartender in a city with a fair few homeless people, so I actually deal with this kind of situation quite a lot. Being a little bit kind/warm/sympathetic to people who are intoxicated/agitated or being uncooperative almost always works.
One last thing is that if you are feeling quite affected by this experience (as it seems you are), then this is also very normal. Almost coming to blows with someone you are a little afraid of (and rightly so) is a very intense experience, and so will produce quite an intense emotional response in you. A good way of dealing with this is to talk about the experience, either anonymously online (as you are doing) or with someone you trust: spouse, sibling, parent, etc. This will help you to process the experience and act on your feelings in a rational, responsible way.
Sorry if this came off condescending, that's not how I meant it. Just wanted to give a clear explanation of my perspective. Good luck!