Aye Aye has been used for centuries, but the phrase “aye aye captain” is more recent and was thought to have originated from sailors in the 18th century. It was most likely a replacement for “yes captain”, which could represent that sailors had listened and understood their instructions.
The Royal Navy and other navy branches continue to use Aye-aye as an affirmative response because of its long history of usage. The term “Aye” (or sometimes just “y”) is still used by some vessels as the signal that they have heard orders, yet it does not necessarily mean that they are ready or able to carry them out. When spoken in reply to an order, it puts stress on the idea that orders are received, understood and will be followed.