Yes, the U.S. has attacked Canada.
The U.S. attempted to conquer Canada, then a British colony, in 1813, during the War of 1812.
American forces got as far as burning the city of York (now Toronto) before being turned back.
In retribution, the British burned much of Washington, D.C., the following year.