Does this happen on all wifi networks? Has it happened sinsce day one? When you setup your phone did you restore as new or from a backup?
First try to " reset network settings".
If that does not work you may want to consider that it some rare cases there have been corrupt backups causing wifi issues. If this happens on all wifi networks and has always happened you may want to consider a trip to the Apple store.