  The origin of the multiwavelength emission from PKS 0502+049 neighboring the
first cosmic neutrino source TXS 0506+056 is studied using the data observed by
Fermi-LAT and Swift UVOT/XRT. This source was in a flaring state in the
considered bands before and after the neutrino observations in 2014-2015,
characterized by hard emission spectra in the X-ray and $\gamma$-ray bands,
$1.5-1.8$ and $\leq2.0$, respectively. During the neutrino observations, the
$\gamma$-ray spectrum shows a deviation from a simple power-law shape,
indicating a spectral cutoff at $E_c =8.50\pm2.06$ GeV. The spectral energy
distributions of PKS 0502+049 are modeled within a one-zone leptonic scenario
assuming that high energy $\gamma$-ray emission is produced either by IC
scattering of synchrotron or dusty torus photons by the electron population
that produce the radio-to-optical emission. Alternatively, the observed
$\gamma$-rays are modeled considering inelastic interaction of protons, when
the jet interacts with a dense gaseous target. During the neutrino
observations, the $\gamma$-ray data are best described when the proton energy
distribution is $E_p^{-2.61}$ and if the protons are effectively accelerated up
to 10 PeV, the expected neutrino rate is $\sim1.1$ events within 110 days. In
principle, if the $\gamma$-ray emission with a hard photon index observed
during the flaring periods extends up to TeV, the expected rate can be somewhat
higher, but such conditions are hardly possible. Within the hadronic
interpretation, the $\gamma$-ray data can be reproduced only when the accretion
rate of PKS 0502+049 is in the supper-Eddington regime, as opposed to the
leptonic scenario. From the point of view of the necessary energetics as well
as considering that the required parameters are physically reasonable, when the
neutrinos were observed, the broadband emission from PKS 0502+049 is most
likely of a leptonic origin.
