Hi belled -- this sounds like the main culprit impacting your ability to sleep last night was having a lot of caffeine and sugar too close to bedtime, which is a normal reaction to those kinds of substances.
As for caffeine and sugar making you horny specifically, that's a bit of a toss up. A lot of sugar results in a temporary burst of energy but is followed by a "crash" where you feel a little tired, so I would say that it is unlikely to make someone horny. Caffeine is a stimulant (it raises levels of physiological or nervous activity in the body) that increases your heart rate and blood pressure, which is also something that happens when you are aroused. It could have perhaps triggered that response in you. I found a few articles online that say that there is a connection between caffeine and horniness, and all of them cited the same University of Texas study. I found the study myself: though it actually existed, it didn't actually recruit participants to study so no actual findings were made... so I'm not sure where those journalists got that information from. Even if the study did go through with their work and they did find caffeine aroused their participants, we don't know if that's just in those participants or if that can be applicable to the population at large (us public health nerds call that "external validity.") Buuuuuuut, I digress! Just thought this was an interesting thing to research.
Though there's a chance your body in particular reacts to sugar and caffeine with horniness, there's also a chance you were both unable to sleep and really horny coincidently. Long story short: nothing out of the ordinary is happening here, but consider cutting back on sugar and caffeine at night when you can.