I'm a father of 3 boys and raised my brother. Boys will be boys. It is normal for kids to talk about sex like Anniebrook said as long as they aren't specifying. Kids usually hear it from friends at school or play groups who have seen it or been told about it. My 6 year old knew some stuff last year from a boy in his class. As for having erections, they are inevitable lol My boys have had erections since birth. Showing off there body parts is just part of being a boy, even if its in front of people. If u have any other ?s feel free to message me. Hope I could help!
If the detail is as though it has actually happened to him; i.e., things he would not have known just from stumbling into porn online or on television, I would start to suspect someone has been doing something to him and look into who he is in contact with in private situations. If the detail is as though he saw something but you don't hear odd details like "it's all wet" (or other stuff that a child would find surprising) then he has probably been watching something he should not have access to, on TV or online. Being goofy with body parts, every little boy tries once and a while. Being specific or explicit, that's not normal for age 5. My son has had erections since he was a baby, but he doesn't know what they are or what they might be for.
Erections are normal. Taking your pants down in front of people is a no-no, and he needs an immediate timeout for that. If he is talking about it in detail, he is getting that information from somewhere - you probably should look into that. Also he is probably getting a lot of attention when he speaks, which is why he keeps doing the talking. If possible, try to completely ignore it. It will stop once he no longer is getting everybodys attention. Or just squash it, by picking certain items that are definitely not allowed and consistently giving immediate, short timeouts.