From what I have read, dried beans of various kinds were a primary food for sailors - which is exactly how the 'navy' bean ended up with that name!
Although the dried beans which were originally a staple of sailors the world over may not have initially all been the same variety of bean, there is one particular type of dried bean (a small white pea bean) which was a common staple of the United States Navy in the early years of the 20th century.
That bean is the one which has now come to be known as the 'navy' bean.