He is known as a tinkerer by other students. He likes to take things apart and repair them when possible.
By his own admission, there was nothing special about this contraption, put together in a few minutes. So, why was he so eager to show the science teacher, as if it was a major achievement? He must have had more intricate projects to show off.
He also knew it might be mistaken for a triggering device, but still went ahead and took it to the classroom, probably against school rules.
Did his militant father have anything to do with it? Hard to believe, but it can't be dismissed entirely.