Did your phone connect to the wi-fi at your school? If so, someone else may have searched it and since your phone was connected to the Wi-Fi the ads are being sent to you also.
All of these smart devices do. It's in the permissions we give. I also don't think it's the device fault but more the products installed such as Google... Facebook... Twitter etc. They collect our info from our devices to give us a more personalized user experience. I don't think it's right and I feel at some point they're will be class action lawsuits but in the meantime.. this is the world we live in. I'm sure now I'll get ads for lawyers and class action websites lol. . . Wonder if I could get those winning megamillion numbers..
It's been proven that devices don't listen to generate ads. It takes too many resources to take audio clips from each device and generate words to pick out specific ads to show. It would be doing this every second on every device.