Yeah, it happens to me too. Guys during puberty get random erections, usually for no reason, but sometimes when they just get a little bit of rubbing even from their pants.
It doesn't happen as much when you're out of puberty. No reason it should happen to you, but it does and it's common, so nothing to worry about
Edit: and welcome to the forums