Welcome to YT! Glad you joined us!
First of all your dog may not be well socialized since you don't know the background, so you are going to be have to be very patient with him/her.
About the lose dogs -- I live I a small suburban area that has leash laws as well -- when we are approached by unleashed dogs I call the police to enforce the law. We have been accosted by large unleashed dogs way to often for me to risk my little dog ( or myself) around them. Believe it or not my actions have earned me a number of new friends. On the big trails I carry a large umbrella, CCW and a police quality taser.
Seems every spring I end up with a few stitches due to unleashed dogs so my tolerance is zero. Most of the big dogs weigh more than I do I have learned.
Your pup may feel threatened if he has a history with aggressive dogs/people.
__________________ .  Cali  , and Cali's keeper and staff, Jay No, not a "mini" Yorkie - She loves to motor in her Mini Cooper car |