You need to cast Soul Trap first, and then kill the creature during the duration of the spell, with the empty soul gem in your inventory. Soul Trap is an apprentice-level Mysticism spell, which can be bought from several different Mages Guild vendors. Soul Trap scrolls can be found, but the best procedure is to either learn the spell, or, best of all, to acquire a weapon enchanted with soul trap.
Higher level creatures need higher level gems. Most of the creatures you encounter at low level will fit in a Petty or Common gem.