Re a middle name which suddenly appears. There are various possibilities.
One is that it is the father's surname. It was quite common for an illegitimate child whose father does not appear on the birth certificate to have the father's surname there as a middle name.
Another possibility is that he was called after someone named James Stewart. I have come across a number of people called, e.g. after a maternal grandfather, say John Smith, where they are registered or, in pre 1855 instances, the baptism register calls them "John" and the "Smith" only appears later as a middle name. The trend for having middle names developed throughout the 19th century.
A third possibility, for older people, is that they just adopted a middle name in later life. I know of one person who did that as his wife and children all had middle names and he thought he should not miss out.