if it was an erection and it lasted all day that would definitely explain it being sore and it wouldn't be entirely unusual for a 13 year old to cum without masturbating.
Bro that's not cum thats pus cause I've had that before and my penis hurt and it was swollen go to a doctors as soon as possible they told me to put some antiswelling cream and it helped right now let all that pus come out then go to the doctors
U seem to have a kidney stone.
to get swelling down masturbate often it works
If your penis was erect for hours on end then you have a medical condtion known as priapism. It is serious and you should seek immediate medical attention.
On the other hand it is perfectly normal for a boy your age to get a spontaneous erection that lasts some time. Gently rubbing your erect penis, moving the foreskin back and forth with your fingers should feel very pleasant and quite addictive. This is known as masturbation or wanking. After a while you will reach orgasm. Semen (cum) will shart shooting uncontrollably from your penis & you will have strange feelings. After that your erection will disappear fairly quickly. That is 'normal operation' of your penis. Should that not happen then seek medcal intervention. Do not be embarrassed to do that, doctors are adults who have usually seen it all before