This is due the size of the atoms that make of the diatomic molecules. Since
Hence, the former molecule has higher polarizability, and thus probabilistically more induced dipoles.
These topics are generally discussed near the end of your first semester of general chemistry. In more complex molecules discussed in organic chemistry, these molecules stabilize negative charge either by induction or directly, among other ways.