While earlier versions of DnD provided greater lore on what spell slots were, DnD 5e only officially says that spell slots are a representation of the difficulty of repeatedly casting a spell without rest. While for your game you may decide to rest on the previous edition's explanation that spells require ‘storage space’ in a magic user's head, and spell slots are a measure of that storage space, feel free to come up with whatever explanation works best for your campaign!