You witnessed a behavior called “mobbing,” where smaller birds swoop and dash at flying or perched larger birds (and sometimes mammals). They typically do this in an effort to drive away potential predators from a breeding territory, a nest or young, or a nonbreeding home range.