The transport layer also has protocols implemented largely in software.
Since the application, presentation and session layers may be handing off large chunks of data, the transport layer segments it into smaller chunks.
These chunks are called datagrams or segments depending on the protocol used.
Furthermore, sometimes some additional information is required to transmit the segment/datagram reliably. The transport layer adds this information to the segment/datagram.
An example of this would be the checksum, which helps ensure that the message is correctly delivered to the destination, i.e. that it’s not corrupted and changed to something else on the way.
When additional information is added to the start of a segment/datagram, it’s called a header.
When additional information is appended to the end it’s called a trailer.