"God is love" is a phrase from the Bible that is simplistic in nature and at the same time profoundly deep. The Apostle John uses the phrase twice in 1 John 4:1-21 ESV. It is important to read the entire chapter to get the context around the two verses which are 1 John 4:8 ESV, and 1 John 4:16 ESV.
When John wrote this, he was speaking to anybody who has Christ in them:
Little children, you are from God and have overcome them, for he who is in you is greater than he who is in the world (1 John 4:4 ESV).
He then establishes that whoever loves one another has been born of God (and consequently knows God) for love is from God:
Beloved, let us love one another, for love is from God, and whoever loves has been born of God and knows God (1 John 4:7 ESV).
John then indicates that if you do not love, you don't know God because God is love:
Anyone who does not love does not know God, because God is love (1 John 4:8).
God is love because He manifested himself in the flesh as a man (John 1:14, 1 Timothy 3:16) so we might live through Him because He died on the cross to be the propitiation (atonement) of our sins. This act of love was not about us loving Him, but about Him loving us:
In this the love of God was made manifest among us, that God sent his only Son into the world, so that we might live through him. In this is love, not that we have loved God but that he loved us and sent his Son to be the propitiation for our sins (1 John 4:9-10 ESV).
John then emphatically states because God so loved us that we need to love one another. Why? Because when we love one another He lives in us and His love is perfected in us.
Beloved, if God so loved us, we also ought to love one another. No one has ever seen God; if we love one another, God abides in us and his love is perfected in us (1 John 4:11-12 ESV).
Then it follows that if we do not love one another, God will not live in us and we will never be perfected in His love. John then reconfirms that the Spirit and Jesus are one in the same, abiding in us:
By this we know that we abide in him and he in us, because he has given us of his Spirit (1 John 4:13 ESV).
He then stresses one more time Jesus is God and He sacrificed His life for us providing salvation through obedience to the gospel:
And we have seen and testify that the Father has sent his Son to be the Savior of the world. Whoever confesses that Jesus is the Son of God, God abides in him, and he in God (1 John 4:14-15 ESV).
Why did Jesus do this? By giving us the gospel, His death, burial and resurrection (1 Corinthians 15:1-4), we would know and believe that He loves us, and that He is love, and if we love others we will be in Him and He will be in us:
So we have come to know and to believe the love that God has for us. God is love, and whoever abides in love abides in God, and God abides in him (1 John 4:16 ESV).
Possessing this kind of love, His love is then perfected in us such that with this perfection we will be able to cast out all fear in this world and at judgement day:
By this is love perfected with us, so that we may have confidence for the day of judgment, because as he is so also are we in this world. There is no fear in love, but perfect love casts out fear. For fear has to do with punishment, and whoever fears has not been perfected in love (1 John 4:17-18 ESV).
John then reminds us that we love Jesus because He first loved us,
We love him because he first loved us (1 John 4:19).
and that we cannot love Him if we do not love our brother:
If anyone says, “I love God,” and hates his brother, he is a liar; for he who does not love his brother whom he has seen cannot love God whom he has not seen. And this commandment we have from him: whoever loves God must also love his brother (1 John 4:20-21 ESV).
The conclusion of this matter is that if we do not love our brother, it is impossible for us to love Jesus and have the Holy Spirit reside in us, resulting in a fearful life in the world today and come judgement day.