It is not uncommon for a male to get an erection when he is relaxed, the muscles are not using as much oxygen and therefore aren't receiving the same blood supply as when they are tense or under
strain, this leave more blood available for the rest of our body, including the penis.
Don't worry about it.