D&D gives room for players to be creative and have in a variety of ways. Not everyone plays the game for the same exact reasons.
Storytellers: There's a common trope about how DMs are usually creative writing majors/minors or are just really into writing. These kinds of players play D&D to be able to tell a grand story about characters ranging from fun and simple to deep and complicated. Whether it is the DM who builds the world and it's history or a player who wants to write and play a complicated character, the collaborative and improvised nature of D&D can provide that outlet.
Role-Players: These are your actors or theatre kids. I'm not either but I did enjoy the one improv class I took in high school a little too much. Now I can continue having fun doing improv through D&D as it requires you to embody characters and make up decisions and dialogue in the moment. Getting to let your imagination run wild and create a character to become can be very appealing. This is especially true due to the nature of improv as a way to cut loose and be unafraid to act ridiculous, as long as everyone playing buys into it, there is a lot fun to be had. Perhaps you're an orphan learning to open up to a group of strangers, a cleric on a holy journey of redemption or a dumb barbarian cracking jokes as the comic relief character.
Min-maxers: Some people also like to play D&D because they not only like math, but they also enjoy power. The term for these people are min-maxers. These are people who look at all of the class, race and ability options available in D&D and only make choices that contribute to optimizing their character as much as possible. Some people make these choices purely out of personal preference, but min-maxers like to make the craziest combination of character building choices so that they can stretch the game's system to it's absolute limits. A lot of time, they make choices to create characters that can deal the most damage possible or practically invulnerable to damage.Â
Social: You can also just enjoy the game for it's social aspect. Like a lot of cooperative games, it's always more fun to have a period of time where you can unwind and let loose while you fool around with your friends. Sometimes you don't need a specific reason to play monopoly or uno with your friends other than it being fun and you wanting to do a fun group activity.