Sometimes a person with a penis may experience an erection, hardening of the penis, unexpectedly. Like you noted, this can happen at school as well as at other times during the day. Realize this happens because your body is practicing what it means to be a sexual being. As you get older, you will be able to have more control over getting erections. In the meantime, when you get one now, try to think of something that does not “turn you on,” like eating liver and onions or some boring historical fact/mathematical equation. Also, you can shift your penis to make it less noticeable, place a jacket or book on your lap, go somewhere private until the erection goes away, and/or wear baggy pants, boxer shorts, or an untucked shirt/sweater to make things less noticeable.