Have you ever tried to perform network communications with a rock? How about a network router that has no electricity? It's pretty boring, because you get no response.
So attackers try to use the most common network protocols, like TCP and UDP, which use numbers that are called "port numbers", or "ports". (SCTP also uses ports.)
If a port is closed, then there's typically one of two results: a response that indicates "Connection refused", or no response whatsoever. Well, either of those results are far less interesting than an "open" port, which simply means that the attacker can get some other type of response when trying to interact with the targeted device.
Port scanning can refer to scanning the entire possible range of port numbers (0 through 65535), or simply scanning from a list of likely ports (e.g., 80, 443, 25, 22) to see what IP addresses respond. IP addresses that respond to a port number are likely targets for attackers to focus additional efforts to interact with, particularly if the port number which responds is the number of a commonly used standard (e.g., TCP port 80 is the most common port for HTTP).
(Although people can use a port for a different purpose than what is standard, that is quite uncommon to do, mostly because a lot of software doesn't handle alternate port numbers as easily. For instance, the standard for web browsers is to require adding a colon, and the port number, if a non-standard port is used. Using standard port numbers can eliminate the need for people to type that information.)
Scanning a port also has advantages over trying to perform more elaborate interactions, like many network attacks. The required time and bandwidth is much lower, so scanning can be done much more quickly than attacks that are more elaborate.