Early gunpowder weaponry was definitely intended first and foremost as a weapon of war. Exactly what role it was to play in warfare, however, remained rather unclear for the first few centuries of their existence.
The very first reference we have to guns is in the form of a manuscript illustration in a treatise on kingship written for a very young Edward III of England by Walter de Milemete. Unfortunately, for the rest of the century we're forced to struggle with scraps of historical references to piece together how gunpowder weapons developed. We know, for example, that they were probably used at the Battle of Crecy but we don't know how and they don't seem to have made much of an impression on either the battle or those who wrote about it later. It's not really until the 15th century with the invention of corned powder and several new developments in gunpowder technology (including, towards the latter half of the century, the matchlock) that we begin to see guns have a significant transformative effect on warfare. That's not to say they had no impact in the 14th century, Kelly DeVries has made a convincing argument that the Battle of Beverhoutsfeld in 1382 was probably the first battle to ever be decided by gunpowder weapons, but also notes that this result is in no small part a product of the specifics of that battle and not necessarily indicative of a grand transformation in military tactics.
In general, gunpowder weaponry in the Middle Ages would never be used to hunt for food. I would be surprised if even in the early modern era it served that purpose. Guns were expensive and gunpowder was prohibitively expensive - particularly in the 14th century, although it's price declined significantly over the following centuries it was never what you might call cheap. This was not the kind of weapon that commoners were taking out to hunt for their dinners with - not when you could achieve the same effect with a bow.
I'm not entirely sure about whether gunpowder weapons were used in the 15th century for hunting, my instinct would be to say that they were not, though. Handheld firearms were still very rare at this stage - most guns were field artillery, sort of like the modern cannon but if there were like 100 different kinds of cannon none of theme exactly like any other. You can't exactly go hunting for deer with a piece of light field artillery, certainly not if you want to eat that deer later! Handheld weaponry became more common as the 15th century progressed, but it wasn't until the invention of the wheel lock in the early 16th century allowed for the ignition of gunpowder without the use of an open flame that handheld firearms really took off. It's no coincidence that this is also when the first pistols begin to appear. Gunpowder weaponry still wouldn't be ideal for hunting - guns (especially wheel lock guns) and gunpowder were still very expensive at that time - but they certainly were used by wealthy individuals at the time, although very much for sport hunting rather than sustenance.
Target and sport shooting was also very popular at least from the 15th century if not before. There were several types of competition that were popular at the time, although in most cases we have to guess the specific rules based on the name of the contest and a few context clues. These competitions were primarily popular with a wealthy urban elite, and so wouldn't have overlapped particularly with a rural hunting crowd.
If you're interested in reading more on early gunpowder, the most accessible general history is Bert Hall's Weapons and Warfare in Renaissance Europe: Gunpowder, Technology, and Tactics, do check that out if this is your kind of thing.