The Portal gun isn't part of the standard Half-Life 2 experience, but the modding community has you covered.
With a bit of searching, you're bound to come across fan-made hacks and mods that add the Portal gun into the game. Just be cautious about where you download files from, and stick to trusted modding sites to avoid unwanted surprises.