That's not a tug boat it's a pilot boat. It carries the harbor pilot out where the pilot boards the ship and guides it into and out of the harbor.
A maritime pilot, marine pilot, harbor pilot, port pilot, ship pilot, or simply pilot, is a mariner who has specific knowledge of an often dangerous or congested waterway, such as harbors or river mouths. Maritime pilots know local details such as depth, currents, and hazards. They board and temporarily join the crew to safely guide the ship's passage, so they must also have expertise in handling ships of all types and sizes.
That's not a tug boat it's a pilot boat. It carries the harbor pilot out where the pilot boards the ship and guides it into and out of the harbor.
https://en.wikipedia.org/wiki/Maritime_pilot